# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID b1d436f094faa1a681f94497ddf6a84b15e7d493
# Parent 825be74657c314c7b73f8f1cdb39a4445aace2ea
[PRIVCMD] Fix build warning when sizeof(long) > sizeof(int).
Original patch from Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff -r 825be74657c3 -r b1d436f094fa
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Sat Nov 11
01:25:00 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Sat Nov 11
01:40:16 2006 +0000
@@ -165,7 +165,7 @@ static int privcmd_ioctl(struct inode *i
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
xen_pfn_t __user *p;
- unsigned long addr, mfn;
+ unsigned long addr, mfn, nr_pages;
int i;
if (!is_initial_xendomain())
@@ -174,7 +174,8 @@ static int privcmd_ioctl(struct inode *i
if (copy_from_user(&m, udata, sizeof(m)))
return -EFAULT;
- if ((m.num <= 0) || (m.num > (LONG_MAX >> PAGE_SHIFT)))
+ nr_pages = m.num;
+ if ((m.num <= 0) || (nr_pages > (LONG_MAX >> PAGE_SHIFT)))
return -EINVAL;
down_read(&mm->mmap_sem);
@@ -182,8 +183,7 @@ static int privcmd_ioctl(struct inode *i
vma = find_vma(mm, m.addr);
if (!vma ||
(m.addr != vma->vm_start) ||
- ((m.addr + ((unsigned long)m.num<<PAGE_SHIFT)) !=
- vma->vm_end) ||
+ ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) ||
!privcmd_enforce_singleshot_mapping(vma)) {
up_read(&mm->mmap_sem);
return -EINVAL;
@@ -191,7 +191,7 @@ static int privcmd_ioctl(struct inode *i
p = m.arr;
addr = m.addr;
- for (i = 0; i < m.num; i++, addr += PAGE_SIZE, p++) {
+ for (i = 0; i < nr_pages; i++, addr += PAGE_SIZE, p++) {
if (get_user(mfn, p)) {
up_read(&mm->mmap_sem);
return -EFAULT;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|