[PATCH RFC v2 2/6] staging: comedi: comedi.h: remove __user tag from chanlist

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

 



The 'chanlist' is passed to the kernel from user space with the
COMEDI_CMD and COMEDI_CMDTEST ioctls. The do_cmd_ioctl() and
do_cmdtest_ioctl() functions in comedi_fops.c copy this data
to/from user space to kernel space correctly.

Unfortunately, this data is copied back into a struct comedi_cmd
so when the cmd is passed down to the drivers they still see the
pointer as __user data. This results is a number of sparse errors
such as:

  warning: dereference of noderef expression

  warning: incorrect type in argument 2 (different address spaces)
     expected void const *<noident>
     got unsigned int [noderef] <asn:1>*chanlist

  warning: incorrect type in argument 3 (different address spaces)
     expected unsigned int *chanlist
     got unsigned int [noderef] <asn:1>*chanlist

  warning: incorrect type in assignment (different address spaces)
     expected unsigned int *ai_chanlist
     got unsigned int [noderef] <asn:1>*chanlist

The two functions in comedi_fops are the only ones that need the
__user tag. Remove the tag so that all the drivers see the chanlist
pointer in the correct address space.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/comedi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index 76cdb2c..133f013 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -365,7 +365,7 @@ struct comedi_cmd {
 	unsigned int stop_src;
 	unsigned int stop_arg;
 
-	unsigned int __user *chanlist;	/* channel/range list */
+	unsigned int *chanlist;	/* channel/range list */
 	unsigned int chanlist_len;
 
 	short __user *data; /* data list, size depends on subd flags */
-- 
1.7.11

_______________________________________________
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