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 Mon, Sep 17, 2012 at 05:17:02PM -0700, H Hartley Sweeten wrote:
> diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
> index 8ea55ae..f986370 100644
> --- a/drivers/staging/comedi/comedi.h
> +++ b/drivers/staging/comedi/comedi.h
> @@ -365,7 +365,10 @@
>  		unsigned int stop_src;
>  		unsigned int stop_arg;
>  
> -		unsigned int __user *chanlist;	/* channel/range list */
> +		union {
> +			unsigned int __user *user_data;
> +			unsigned int *kernel_data;
> +		} chanlist;		/* channel/range list */
>  		unsigned int chanlist_len;
>  
>  		short __user *data; /* data list, size depends on subd flags */

Everything in this file is indented one step too far so git diff
doesn't know which struct is being modified.  It should say:

--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -365,6 +365,7 @@ struct comedi_cmd {
                           ^^^^^^^^^^

I would just make it a kernel pointer and do casting inside
do_cmd_ioctl().  ->kernel_data is an awkward name, compared to
->chanlist.  The fact that it's kernel data is already build into
the data type because it doesn't have a __user annotation.

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