summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-09-18 18:46:57 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-19 10:26:12 (GMT)
commitdc881f294eb957bded69b5e7f2f72831e2d00ac4 (patch)
tree82bd0ddba8e1f80800400cfe9b8bcaefd0f9dfbd /drivers
parent0352b932be274d0d67b02f93fe94e30e57265f85 (diff)
downloadlinux-fsl-qoriq-dc881f294eb957bded69b5e7f2f72831e2d00ac4.tar.xz
staging: comedi: fix sparse warning in do_devconfig_ioctl()
For the COMEDI_DEVCONFIG ioctl, the user application may embed a pointer to firmware data within a designated element (or two elements for 64-bit pointers) of the `options[]` array in the `struct comedi_devconfig`. `do_devconfig_ioctl()` calls `comedi_aux_data()` to extract the pointer value. It needs to be treated as a `__user` pointer so the firmware data can be copied into kernel memory, so cast the result of `comedi_aux_data()` to avoid a "sparse" warning. This is not ideal but `comedi_aux_data()` is called elsewhere in a wholly kernel memory context so we can't just change its return type to include the `__user` tag. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/comedi_fops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 626fa72..9b9d4e8 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -370,7 +370,8 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
return -ENOMEM;
if (copy_from_user(aux_data,
- comedi_aux_data(it.options, 0), aux_len)) {
+ (unsigned char __user *
+ )comedi_aux_data(it.options, 0), aux_len)) {
vfree(aux_data);
return -EFAULT;
}