Re: [PATCH, RFC] usb devio: Use get_user() instead of __get_user()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 29 July 2009 03:57:54 Pete Zaitcev wrote:
> On Sun, 19 Jul 2009 23:24:20 -0700, Greg KH <gregkh@xxxxxxx> wrote:
> 
> > Pete would know best, as he added this code way back in 2005 in commit
> > c36fc889.
> 
> This may be an instance of cargo cult programming on my part
> or just a thinko.
> 
> > Pete, any thoughts on the patch below?
> 
> > > +++ linux-2.6/drivers/usb/core/devio.c
> > > @@ -1531,21 +1531,21 @@ static int proc_ioctl_default(struct dev
> 
> > >  	uioc = compat_ptr((long)arg);
> > >  	if (get_user(ctrl.ifno, &uioc->ifno) ||
> > >  	    get_user(ctrl.ioctl_code, &uioc->ioctl_code) ||
> > > -	    __get_user(udata, &uioc->data))
> > > +	    get_user(udata, &uioc->data))
> > >  		return -EFAULT;
> > >  	ctrl.data = compat_ptr(udata);
> 
> I don't see why not.
> 
> -- Pete
> 
> 

Ok, the same applies to the get_urb32 function then, right? Should I send a patch
to change both functions?

1320 static int get_urb32(struct usbdevfs_urb *kurb,
1321                      struct usbdevfs_urb32 __user *uurb)
1322 {
1323         __u32  uptr;
1324         if (get_user(kurb->type, &uurb->type) ||
1325             __get_user(kurb->endpoint, &uurb->endpoint) ||
1326             __get_user(kurb->status, &uurb->status) ||
1327             __get_user(kurb->flags, &uurb->flags) ||
1328             __get_user(kurb->buffer_length, &uurb->buffer_length) ||
1329             __get_user(kurb->actual_length, &uurb->actual_length) ||
1330             __get_user(kurb->start_frame, &uurb->start_frame) ||
1331             __get_user(kurb->number_of_packets, &uurb->number_of_packets) ||
1332             __get_user(kurb->error_count, &uurb->error_count) ||
1333             __get_user(kurb->signr, &uurb->signr))
1334                 return -EFAULT;
1335 
1336         if (__get_user(uptr, &uurb->buffer))
1337                 return -EFAULT;
1338         kurb->buffer = compat_ptr(uptr);
1339         if (__get_user(uptr, &uurb->usercontext))
1340                 return -EFAULT;
1341         kurb->usercontext = compat_ptr(uptr);
1342 
1343         return 0;
1344 }


-- 
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux