diff options
-rw-r--r-- | drivers/hid/hidraw.c | 14 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 18 |
2 files changed, 4 insertions, 28 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 93c72e593701..c79578b5a788 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -395,12 +395,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
395 | } | 395 | } |
396 | 396 | ||
397 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { | 397 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { |
398 | int len; | 398 | int len = strlen(hid->name) + 1; |
399 | if (!hid->name) { | ||
400 | ret = 0; | ||
401 | break; | ||
402 | } | ||
403 | len = strlen(hid->name) + 1; | ||
404 | if (len > _IOC_SIZE(cmd)) | 399 | if (len > _IOC_SIZE(cmd)) |
405 | len = _IOC_SIZE(cmd); | 400 | len = _IOC_SIZE(cmd); |
406 | ret = copy_to_user(user_arg, hid->name, len) ? | 401 | ret = copy_to_user(user_arg, hid->name, len) ? |
@@ -409,12 +404,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
409 | } | 404 | } |
410 | 405 | ||
411 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { | 406 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { |
412 | int len; | 407 | int len = strlen(hid->phys) + 1; |
413 | if (!hid->phys) { | ||
414 | ret = 0; | ||
415 | break; | ||
416 | } | ||
417 | len = strlen(hid->phys) + 1; | ||
418 | if (len > _IOC_SIZE(cmd)) | 408 | if (len > _IOC_SIZE(cmd)) |
419 | len = _IOC_SIZE(cmd); | 409 | len = _IOC_SIZE(cmd); |
420 | ret = copy_to_user(user_arg, hid->phys, len) ? | 410 | ret = copy_to_user(user_arg, hid->phys, len) ? |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 527003188bfe..2baa71e6cc29 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -801,14 +801,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
801 | break; | 801 | break; |
802 | 802 | ||
803 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { | 803 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { |
804 | int len; | 804 | int len = strlen(hid->name) + 1; |
805 | |||
806 | if (!hid->name) { | ||
807 | r = 0; | ||
808 | break; | ||
809 | } | ||
810 | |||
811 | len = strlen(hid->name) + 1; | ||
812 | if (len > _IOC_SIZE(cmd)) | 805 | if (len > _IOC_SIZE(cmd)) |
813 | len = _IOC_SIZE(cmd); | 806 | len = _IOC_SIZE(cmd); |
814 | r = copy_to_user(user_arg, hid->name, len) ? | 807 | r = copy_to_user(user_arg, hid->name, len) ? |
@@ -817,14 +810,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
817 | } | 810 | } |
818 | 811 | ||
819 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { | 812 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { |
820 | int len; | 813 | int len = strlen(hid->phys) + 1; |
821 | |||
822 | if (!hid->phys) { | ||
823 | r = 0; | ||
824 | break; | ||
825 | } | ||
826 | |||
827 | len = strlen(hid->phys) + 1; | ||
828 | if (len > _IOC_SIZE(cmd)) | 814 | if (len > _IOC_SIZE(cmd)) |
829 | len = _IOC_SIZE(cmd); | 815 | len = _IOC_SIZE(cmd); |
830 | r = copy_to_user(user_arg, hid->phys, len) ? | 816 | r = copy_to_user(user_arg, hid->phys, len) ? |