aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/compat_ioctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 31b7efd94d66..43a2508ac696 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -686,7 +686,8 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
686 686
687 ifr = ifc.ifc_req; 687 ifr = ifc.ifc_req;
688 ifr32 = compat_ptr(ifc32.ifcbuf); 688 ifr32 = compat_ptr(ifc32.ifcbuf);
689 for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len; 689 for (i = 0, j = 0;
690 i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len;
690 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { 691 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
691 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) 692 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
692 return -EFAULT; 693 return -EFAULT;
@@ -702,10 +703,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
702 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32)); 703 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
703 ifc32.ifc_len = i; 704 ifc32.ifc_len = i;
704 } else { 705 } else {
705 if (i <= ifc32.ifc_len) 706 ifc32.ifc_len = i;
706 ifc32.ifc_len = i;
707 else
708 ifc32.ifc_len = i - sizeof (struct ifreq32);
709 } 707 }
710 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32))) 708 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
711 return -EFAULT; 709 return -EFAULT;