Re: [PATCH RFC] staging: comedi: fix user/kernel space access of cmd->chanlist

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

 



On Tue, Sep 18, 2012 at 10:48:41AM -0500, H Hartley Sweeten wrote:
> What about just renaming the user version of the struct and then
> creating the 'shadowing' kernel struct without the __user tag?
> 
> This would have the least impact on the code. The drivers would not
> be changed at all. Only comedi_fops deals with the __user version.
> 

It's just four casts...  At the state of do_cmd_ioctl() we do:
	user_chanlist = (unsigned int __user*)user_cmd.chanlist;
and at the end we do:
	user_cmd.chanlist = (unsigned int __force *)user_chanlist;

The same for do_cmdtest_ioctl().

I like your naming and some the other cleanups you did.  I would
switch "user_cmd" to just "cmd" because otherwise it's a bit
confusing.

You also swapped a kmalloc() for a kzalloc()...  If that's a bugfix
it should go in separately, otherwise it's not needed.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux