aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 8503197a8131..a702e2f6da7d 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -229,9 +229,15 @@ static int hidraw_ioctl(struct inode *inode, struct file *file, unsigned int cmd
229 229
230 if (get_user(len, (int __user *)arg)) 230 if (get_user(len, (int __user *)arg))
231 return -EFAULT; 231 return -EFAULT;
232 if (copy_to_user(*((__u8 **)(user_arg + 232
233 sizeof(__u32))), 233 if (len > HID_MAX_DESCRIPTOR_SIZE - 1)
234 dev->hid->rdesc, len)) 234 return -EINVAL;
235
236 if (copy_to_user(user_arg + offsetof(
237 struct hidraw_report_descriptor,
238 value[0]),
239 dev->hid->rdesc,
240 min(dev->hid->rsize, len)))
235 return -EFAULT; 241 return -EFAULT;
236 return 0; 242 return 0;
237 } 243 }