direct-io.hg

changeset 12375:b1d436f094fa

[PRIVCMD] Fix build warning when sizeof(long) > sizeof(int).
Original patch from Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Sat Nov 11 01:40:16 2006 +0000 (2006-11-11)
parents 825be74657c3
children f516774cbb27
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	Sat Nov 11 01:25:00 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sat Nov 11 01:40:16 2006 +0000
     1.3 @@ -165,7 +165,7 @@ static int privcmd_ioctl(struct inode *i
     1.4  		struct mm_struct *mm = current->mm;
     1.5  		struct vm_area_struct *vma;
     1.6  		xen_pfn_t __user *p;
     1.7 -		unsigned long addr, mfn;
     1.8 +		unsigned long addr, mfn, nr_pages;
     1.9  		int i;
    1.10  
    1.11  		if (!is_initial_xendomain())
    1.12 @@ -174,7 +174,8 @@ 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 > (LONG_MAX >> PAGE_SHIFT)))
    1.17 +		nr_pages = m.num;
    1.18 +		if ((m.num <= 0) || (nr_pages > (LONG_MAX >> PAGE_SHIFT)))
    1.19  			return -EINVAL;
    1.20  
    1.21  		down_read(&mm->mmap_sem);
    1.22 @@ -182,8 +183,7 @@ static int privcmd_ioctl(struct inode *i
    1.23  		vma = find_vma(mm, m.addr);
    1.24  		if (!vma ||
    1.25  		    (m.addr != vma->vm_start) ||
    1.26 -		    ((m.addr + ((unsigned long)m.num<<PAGE_SHIFT)) !=
    1.27 -		     vma->vm_end) ||
    1.28 +		    ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) ||
    1.29  		    !privcmd_enforce_singleshot_mapping(vma)) {
    1.30  			up_read(&mm->mmap_sem);
    1.31  			return -EINVAL;
    1.32 @@ -191,7 +191,7 @@ static int privcmd_ioctl(struct inode *i
    1.33  
    1.34  		p = m.arr;
    1.35  		addr = m.addr;
    1.36 -		for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
    1.37 +		for (i = 0; i < nr_pages; i++, addr += PAGE_SIZE, p++) {
    1.38  			if (get_user(mfn, p)) {
    1.39  				up_read(&mm->mmap_sem);
    1.40  				return -EFAULT;