direct-io.hg

changeset 11746:d13809a631b0

Fix privcmd mmap() on 64b architectures for regions larger than 2GB.
Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Oct 12 14:25:51 2006 +0100 (2006-10-12)
parents ec45c27c1500
children 7f6ae888fb7a
files linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Thu Oct 12 14:14:58 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Thu Oct 12 14:25:51 2006 +0100
     1.3 @@ -139,7 +139,7 @@ static int privcmd_ioctl(struct inode *i
     1.4  
     1.5  			/* Do not allow range to wrap the address space. */
     1.6  			rc = -EINVAL;
     1.7 -			if ((msg.npages > (INT_MAX >> PAGE_SHIFT)) ||
     1.8 +			if ((msg.npages > (LONG_MAX >> PAGE_SHIFT)) ||
     1.9  			    ((unsigned long)(msg.npages << PAGE_SHIFT) >= -va))
    1.10  				goto mmap_out;
    1.11  
    1.12 @@ -183,7 +183,7 @@ static int privcmd_ioctl(struct inode *i
    1.13  		if (copy_from_user(&m, udata, sizeof(m)))
    1.14  			return -EFAULT;
    1.15  
    1.16 -		if ((m.num <= 0) || (m.num > (INT_MAX >> PAGE_SHIFT)))
    1.17 +		if ((m.num <= 0) || (m.num > (LONG_MAX >> PAGE_SHIFT)))
    1.18  			return -EINVAL;
    1.19  
    1.20  		down_read(&mm->mmap_sem);
    1.21 @@ -191,7 +191,8 @@ static int privcmd_ioctl(struct inode *i
    1.22  		vma = find_vma(mm, m.addr);
    1.23  		if (!vma ||
    1.24  		    (m.addr != vma->vm_start) ||
    1.25 -		    ((m.addr + (m.num<<PAGE_SHIFT)) != vma->vm_end) ||
    1.26 +		    ((m.addr + ((unsigned long)m.num<<PAGE_SHIFT)) !=
    1.27 +		     vma->vm_end) ||
    1.28  		    !privcmd_enforce_singleshot_mapping(vma)) {
    1.29  			up_read(&mm->mmap_sem);
    1.30  			return -EINVAL;