aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5dd0207ffd46..c666769a875d 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -446,7 +446,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
446 ifr = ifc.ifc_req; 446 ifr = ifc.ifc_req;
447 ifr32 = compat_ptr(ifc32.ifcbuf); 447 ifr32 = compat_ptr(ifc32.ifcbuf);
448 for (i = 0, j = 0; 448 for (i = 0, j = 0;
449 i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len; 449 i + sizeof (struct ifreq32) <= ifc32.ifc_len && j < ifc.ifc_len;
450 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { 450 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
451 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) 451 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
452 return -EFAULT; 452 return -EFAULT;
@@ -931,8 +931,8 @@ struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
932{ 932{
933 int err, i; 933 int err, i;
934 sg_req_info_t *r; 934 sg_req_info_t __user *r;
935 struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; 935 struct compat_sg_req_info __user *o = (void __user *)arg;
936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); 936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
937 err = sys_ioctl(fd,cmd,(unsigned long)r); 937 err = sys_ioctl(fd,cmd,(unsigned long)r);
938 if (err < 0) 938 if (err < 0)
@@ -2531,18 +2531,9 @@ static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
2531 val32 = kval; 2531 val32 = kval;
2532 return put_user(val32, (unsigned int __user *)arg); 2532 return put_user(val32, (unsigned int __user *)arg);
2533 case RTC_IRQP_SET32: 2533 case RTC_IRQP_SET32:
2534 return sys_ioctl(fd, RTC_IRQP_SET, arg);
2534 case RTC_EPOCH_SET32: 2535 case RTC_EPOCH_SET32:
2535 ret = get_user(val32, (unsigned int __user *)arg); 2536 return sys_ioctl(fd, RTC_EPOCH_SET, arg);
2536 if (ret)
2537 return ret;
2538 kval = val32;
2539
2540 set_fs(KERNEL_DS);
2541 ret = sys_ioctl(fd, (cmd == RTC_IRQP_SET32) ?
2542 RTC_IRQP_SET : RTC_EPOCH_SET,
2543 (unsigned long)&kval);
2544 set_fs(oldfs);
2545 return ret;
2546 default: 2537 default:
2547 /* unreached */ 2538 /* unreached */
2548 return -ENOIOCTLCMD; 2539 return -ENOIOCTLCMD;
@@ -2739,8 +2730,8 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
2739static int 2730static int
2740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2731lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
2741{ 2732{
2742 struct compat_timeval *tc = (struct compat_timeval *)arg; 2733 struct compat_timeval __user *tc = (struct compat_timeval __user *)arg;
2743 struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2734 struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval));
2744 struct timeval ts; 2735 struct timeval ts;
2745 if (get_user(ts.tv_sec, &tc->tv_sec) || 2736 if (get_user(ts.tv_sec, &tc->tv_sec) ||
2746 get_user(ts.tv_usec, &tc->tv_usec) || 2737 get_user(ts.tv_usec, &tc->tv_usec) ||