vma->vm_flags |= (VM_RESERVED | VM_IO); 
vma->vm_flags |= VM_RESERVED; 
sg_mmap(struct file *filp, struct vm_area_struct *vma){	Sg_fd *sfp;	unsigned long req_sz;	Sg_scatter_hold *rsv_schp;	if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data)))		return -ENXIO;	req_sz = vma->vm_end - vma->vm_start;	SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n",				   (void *) vma->vm_start, (int) req_sz));	if (vma->vm_pgoff)		return -EINVAL;	/* want no offset */	rsv_schp = &sfp->reserve;	if (req_sz > rsv_schp->bufflen)		return -ENOMEM;	/* cannot map more than reserved buffer */	if (rsv_schp->k_use_sg) { /* reserve buffer is a scatter gather list */		int k;		unsigned long sa = vma->vm_start;		unsigned long len;		struct scatterlist *sclp = rsv_schp->buffer;		for (k = 0; (k < rsv_schp->k_use_sg) && (sa < vma->vm_end);		     ++k, ++sclp) {			if (0 != sclp->offset)				return -EFAULT;	/* non page aligned memory ?? */			len = vma->vm_end - sa;			len = (len < sclp->length) ? len : sclp->length;			sa += len;		}	} else {	/* reserve buffer is just a single allocation */		if ((unsigned long) rsv_schp->buffer & (PAGE_SIZE - 1))			return -EFAULT;	/* non page aligned memory ?? */	}	if (0 == sfp->mmap_called) {		sg_rb_correct4mmap(rsv_schp, 1);	/* do only once per fd lifetime */		sfp->mmap_called = 1;	}	vma->vm_flags |= (VM_RESERVED | VM_IO);	vma->vm_private_data = sfp;	vma->vm_ops = &sg_mmap_vm_ops;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1c8e71d72026ed4c6ba0fdfd7eebd865f4fd1415/sg.c/buggy/drivers/scsi/sg.c