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 Tuesday, September 18, 2012 9:15 AM, Ian Abbott wrote:
> On 2012-09-18 16:48, 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?
>
> Partly because I've already changed it locally and partly because the 
> current name matches the ioctl it is associated with.

Changed what locally? Are you going to post a patch for this?

As far as the name in to ioctl goes...

My proposed change would make the two structs:

struct comedi_user_cmd {
	...
	unsigned int __user *chanlist;
	...
	short __user *data;
	...
};

struct comedi_cmd {
	...
	unsigned int *chanlist;
	...
	short *data;
	...
};

And the ioctls would be:

#define COMEDI_CMD _IOR(CIO, 9, struct comedi_user_cmd)
#define COMEDI_CMDTEST _IOR(CIO, 10, struct comedi_user_cmd)

Comedilib has this for the ioctls:

#define COMEDI_CMD _IOR(CIO,9,comedi_cmd)
#define COMEDI_CMDTEST _IOR(CIO,10,comedi_cmd)

With comedi_cmd being a typedef. So there is already an ioctl difference between
the kernel and the userspace library.

Regards,
Hartley

_______________________________________________
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