diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 12:10:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 12:10:03 -0400 |
commit | ee9ec4f82049c678373a611ce20ac67fe9ad836e (patch) | |
tree | e5ec44a30720f1db1cd4a803b3711a2293322dc5 /drivers/hid/hidraw.c | |
parent | e0c6b8a17fb3d4a740386b380ea72aa8388fbf2f (diff) | |
parent | 366a2382c68d01638350efcf23d46a47d661c595 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (36 commits)
HID: hid-multitouch: cosmetic changes, sort classes and devices
HID: hid-multitouch: class MT_CLS_STANTUM is redundant with MT_CLS_CONFIDENCE
HID: hid-multitouch: add support for Unitec panels
HID: hid-multitouch: add support for Touch International panels
HID: hid-multitouch: add support for GoodTouch panels
HID: hid-multitouch: add support for CVTouch panels
HID: hid-multitouch: add support for ActionStar panels
HID: hiddev: fix race between hiddev_disconnect and hiddev_release
HID: magicmouse: ignore 'ivalid report id' while switching modes
HID: fix a crash in hid_report_raw_event() function.
HID: hid-multitouch: add support for Elo TouchSystems 2515 IntelliTouch Plus
HID: assorted usage updates from hut 1.12
HID: roccat: fix actual/startup profile sysfs attribute in koneplus
HID: hid-multitouch: Add support for Lumio panels
HID: 'name' and 'phys' in 'struct hid_device' can never be NULL
HID: hid-multitouch: add support for Ilitek dual-touch panel
HID: picolcd: Avoid compile warning/error triggered by copy_from_user()
HID: add support for Logitech G27 wheel
HID: hiddev: fix error path in hiddev_read when interrupted
HID: add support for Sony Navigation Controller
...
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r-- | drivers/hid/hidraw.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 54409cba018c..c79578b5a788 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -101,8 +101,8 @@ out: | |||
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | /* the first byte is expected to be a report number */ | 104 | /* The first byte is expected to be a report number. |
105 | /* This function is to be called with the minors_lock mutex held */ | 105 | * This function is to be called with the minors_lock mutex held */ |
106 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) | 106 | static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type) |
107 | { | 107 | { |
108 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 108 | unsigned int minor = iminor(file->f_path.dentry->d_inode); |
@@ -166,11 +166,11 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
166 | 166 | ||
167 | 167 | ||
168 | /* This function performs a Get_Report transfer over the control endpoint | 168 | /* This function performs a Get_Report transfer over the control endpoint |
169 | per section 7.2.1 of the HID specification, version 1.1. The first byte | 169 | * per section 7.2.1 of the HID specification, version 1.1. The first byte |
170 | of buffer is the report number to request, or 0x0 if the defice does not | 170 | * of buffer is the report number to request, or 0x0 if the defice does not |
171 | use numbered reports. The report_type parameter can be HID_FEATURE_REPORT | 171 | * use numbered reports. The report_type parameter can be HID_FEATURE_REPORT |
172 | or HID_INPUT_REPORT. This function is to be called with the minors_lock | 172 | * or HID_INPUT_REPORT. This function is to be called with the minors_lock |
173 | mutex held. */ | 173 | * mutex held. */ |
174 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) | 174 | static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type) |
175 | { | 175 | { |
176 | unsigned int minor = iminor(file->f_path.dentry->d_inode); | 176 | unsigned int minor = iminor(file->f_path.dentry->d_inode); |
@@ -207,7 +207,7 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t | |||
207 | } | 207 | } |
208 | 208 | ||
209 | /* Read the first byte from the user. This is the report number, | 209 | /* Read the first byte from the user. This is the report number, |
210 | which is passed to dev->hid_get_raw_report(). */ | 210 | * which is passed to dev->hid_get_raw_report(). */ |
211 | if (copy_from_user(&report_number, buffer, 1)) { | 211 | if (copy_from_user(&report_number, buffer, 1)) { |
212 | ret = -EFAULT; | 212 | ret = -EFAULT; |
213 | goto out_free; | 213 | goto out_free; |
@@ -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) ? |