diff options
| author | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2002-05-18 22:25:13 -0300 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-05-18 22:25:13 -0300 |
| commit | a465121e2b8a3e2cdb2aa39ab35d5a5131230265 (patch) | |
| tree | a5e81c2be8ad87d846abfb4a84369428e340d6a2 /drivers/usb/input | |
| parent | 291884c98ae119a91d8afe0131019c66e3d6fbc7 (diff) | |
drivers/usr/*.c
- fix copy_{to,from}_user error handling (thanks to Rusty for pointing this out)
Diffstat (limited to 'drivers/usb/input')
| -rw-r--r-- | drivers/usb/input/hiddev.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 88f0d76c8c7a..0e4347fa11e1 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c @@ -389,7 +389,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, 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; + return 0; } case HIDIOCGFLAG: @@ -480,7 +482,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, 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; + return 0; case HIDIOCGFIELDINFO: { @@ -512,7 +516,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, 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; + return 0; } case HIDIOCGUCODE: @@ -533,7 +539,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, 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; + return 0; case HIDIOCGUSAGE: case HIDIOCSUSAGE: @@ -564,7 +572,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, if (cmd == 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; } else { field->value[uref.usage_index] = uref.value; } |
