From: "Jan Beulich" Subject: [PATCH] linux/privcmd: mmapbatch-v2 fixes Date: Thu, 21 Jan 2010 11:41:35 +0000 Message-ID: <4B584B7F020000780002B44C@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3913277F.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3913277F.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline - clear error indication array when no error encountered - no need to copy back mfn array in comapt mode shim Signed-off-by: Jan Beulich --- a/drivers/xen/privcmd/compat_privcmd.c +++ b/drivers/xen/privcmd/compat_privcmd.c @@ -102,7 +102,7 @@ int privcmd_ioctl_32(int fd, unsigned in struct privcmd_mmapbatch_v2_32 n32; #ifdef xen_pfn32_t xen_pfn_t *__user arr; - xen_pfn32_t *__user arr32; + const xen_pfn32_t *__user arr32; unsigned int i; #endif =20 @@ -133,17 +133,6 @@ int privcmd_ioctl_32(int fd, unsigned in #endif =20 ret =3D sys_ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, = (unsigned long)p); - -#ifdef xen_pfn32_t - for (i =3D 0; !ret && i < n32.num; ++i) { - xen_pfn_t mfn; - - if (get_user(mfn, arr + i) || put_user(mfn, arr32 = + i)) - ret =3D -EFAULT; - else if (mfn !=3D (xen_pfn32_t)mfn) - ret =3D -ERANGE; - } -#endif } break; default: --- sle11sp1-2010-01-20.orig/drivers/xen/privcmd/privcmd.c 2010-01-19 = 10:33:58.000000000 +0100 +++ sle11sp1-2010-01-20/drivers/xen/privcmd/privcmd.c 2010-01-21 = 12:21:44.000000000 +0100 @@ -389,7 +389,8 @@ static long privcmd_ioctl(struct file *f ret =3D -EFAULT; i +=3D nr; p +=3D nr; } - } + } else if (clear_user(m.err, nr_pages * sizeof(*m.err))) + ret =3D -EFAULT; =20 mmapbatch_v2_out: list_for_each_safe(l, l2, &pagelist) --=__Part3913277F.0__= Content-Type: text/plain; name="xenlinux-privcmd-mmap-batch-clear.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xenlinux-privcmd-mmap-batch-clear.patch" Subject: privcmd: mmapbatch-v2 fixes=0A=0A- clear error indication array = when no error encountered=0A- no need to copy back mfn array in comapt = mode shim=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/drivers/xen/privcmd/compat_privcmd.c=0A+++ b/drivers/xen/privcmd/compat_p= rivcmd.c=0A@@ -102,7 +102,7 @@ int privcmd_ioctl_32(int fd, unsigned in=0A = struct privcmd_mmapbatch_v2_32 n32;=0A #ifdef xen_pfn32_t= =0A xen_pfn_t *__user arr;=0A- xen_pfn32_t = *__user arr32;=0A+ const xen_pfn32_t *__user arr32;=0A = unsigned int i;=0A #endif=0A =0A@@ -133,17 +133,6 @@ int privcmd_ioctl_32(i= nt fd, unsigned in=0A #endif=0A =0A ret =3D sys_ioctl(fd, = IOCTL_PRIVCMD_MMAPBATCH_V2, (unsigned long)p);=0A-=0A-#ifdef xen_pfn32_t=0A= - for (i =3D 0; !ret && i < n32.num; ++i) {=0A- = xen_pfn_t mfn;=0A-=0A- if (get_user(mfn, arr + i) || = put_user(mfn, arr32 + i))=0A- ret =3D -EFAULT;=0A= - else if (mfn !=3D (xen_pfn32_t)mfn)=0A- = ret =3D -ERANGE;=0A- }=0A-#endif=0A }=0A = break;=0A default:=0A--- sle11sp1-2010-01-20.orig/drivers/xen/privcmd= /privcmd.c 2010-01-19 10:33:58.000000000 +0100=0A+++ sle11sp1-2010-01-= 20/drivers/xen/privcmd/privcmd.c 2010-01-21 12:21:44.000000000 = +0100=0A@@ -389,7 +389,8 @@ static long privcmd_ioctl(struct file *f=0A = ret =3D -EFAULT;=0A = i +=3D nr; p +=3D nr;=0A }=0A- }=0A+ = } else if (clear_user(m.err, nr_pages * sizeof(*m.err)))=0A+ = ret =3D -EFAULT;=0A =0A mmapbatch_v2_out:=0A list_for_ea= ch_safe(l, l2, &pagelist)=0A --=__Part3913277F.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part3913277F.0__=--