From 2010f52947ead959840b9c5a61ca6d1e0bdd73cf Mon Sep 17 00:00:00 2001 From: Alexandra Kossovsky Date: Sun, 20 Nov 2005 13:41:59 -0800 Subject: [PATCH] --- yaml --- r: 14562 b: refs/heads/master c: 4909724b5dee8fb7c52bbe90afa40c65b17be9eb h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/compat_ioctl.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index fb0ffbdcc788..67204a25c53a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fb0d366b0803571f06a5b838f02c6706fc287995 +refs/heads/master: 4909724b5dee8fb7c52bbe90afa40c65b17be9eb diff --git a/trunk/fs/compat_ioctl.c b/trunk/fs/compat_ioctl.c index 31b7efd94d66..43a2508ac696 100644 --- a/trunk/fs/compat_ioctl.c +++ b/trunk/fs/compat_ioctl.c @@ -686,7 +686,8 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) ifr = ifc.ifc_req; ifr32 = compat_ptr(ifc32.ifcbuf); - for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len; + for (i = 0, j = 0; + i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len; i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) return -EFAULT; @@ -702,10 +703,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32)); ifc32.ifc_len = i; } else { - if (i <= ifc32.ifc_len) - ifc32.ifc_len = i; - else - ifc32.ifc_len = i - sizeof (struct ifreq32); + ifc32.ifc_len = i; } if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32))) return -EFAULT;