diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-21 13:46:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-21 13:46:34 -0500 |
commit | 1a324727caa26cd65a359a958c90fbd251d4aa49 (patch) | |
tree | 543a4f413c1c99f4b5be0b3c5f3744c9e4581db9 /fs | |
parent | db93a82fa9d8b4d6e31c227922eaae829253bb88 (diff) | |
parent | 461ddf3b90bb149b99c3f675959c1bd6b11ed936 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat_ioctl.c | 8 |
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; |