diff options
| author | Vojtech Pavlik <vojtech@suse.cz> | 2002-07-15 03:18:59 -0700 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@suse.cz> | 2002-07-15 03:18:59 -0700 |
| commit | 793fb491657f2a4c82d96a92c3b539f3c131b3bf (patch) | |
| tree | 08b5cb694a2c6c0dfa94a26872e8115104d9a4ce /drivers/usb/input | |
| parent | b24be862cc6543ef76e17c55cc11c69e2dd8bc62 (diff) | |
[PATCH] Reintroduce proper returning of -EFAULT to hiddev.c
One of my earlier patches backed out a change that fixed all
copy_to_user calls to properly return -EFAULT if needed. This puts the
change back in.
Diffstat (limited to 'drivers/usb/input')
| -rw-r--r-- | drivers/usb/input/hiddev.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 8b5cd439eee7..8ac1b9111145 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c @@ -399,10 +399,12 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd dinfo.product = dev->descriptor.idProduct; dinfo.version = dev->descriptor.bcdDevice; dinfo.num_applications = hid->maxapplication; - return copy_to_user((void *) arg, &dinfo, sizeof(dinfo)); + if (copy_to_user((void *) arg, &dinfo, sizeof(dinfo))) + return -EFAULT; case HIDIOCGFLAG: - return put_user(list->flags, (int *) arg); + if (put_user(list->flags, (int *) arg)) + return -EFAULT; case HIDIOCSFLAG: { @@ -488,7 +490,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd rinfo.num_fields = report->maxfield; - return copy_to_user((void *) arg, &rinfo, sizeof(rinfo)); + if (copy_to_user((void *) arg, &rinfo, sizeof(rinfo))) + return -EFAULT; case HIDIOCGFIELDINFO: if (copy_from_user(&finfo, (void *) arg, sizeof(finfo))) @@ -518,7 +521,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd finfo.unit_exponent = field->unit_exponent; finfo.unit = field->unit; - return copy_to_user((void *) arg, &finfo, sizeof(finfo)); + if (copy_to_user((void *) arg, &finfo, sizeof(finfo))) + return -EFAULT; case HIDIOCGUCODE: if (copy_from_user(&uref, (void *) arg, sizeof(uref))) @@ -538,7 +542,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd uref.usage_code = field->usage[uref.usage_index].hid; - return copy_to_user((void *) arg, &uref, sizeof(uref)); + if (copy_to_user((void *) arg, &uref, sizeof(uref))) + return -EFAULT; case HIDIOCGUSAGE: case HIDIOCSUSAGE: @@ -570,7 +575,8 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd switch (cmd) { case HIDIOCGUSAGE: uref.value = field->value[uref.usage_index]; - return copy_to_user((void *) arg, &uref, sizeof(uref)); + if (copy_to_user((void *) arg, &uref, sizeof(uref))) + return -EFAULT; return 0; case HIDIOCSUSAGE: |
