aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-logitech-dj.h
diff options
context:
space:
mode:
authorNestor Lopez Casado <nlopezcasad@logitech.com>2011-09-20 09:59:03 -0400
committerJiri Kosina <jkosina@suse.cz>2011-09-20 10:09:22 -0400
commit844580ff63ef4eb19eec4cfd8cd6e0b62d81279f (patch)
tree09efe63d4917899fd8adb340867f3662f6579895 /drivers/hid/hid-logitech-dj.h
parent534a7b8e10ec55d9f521e68c20dbb3634c25b98a (diff)
HID: hid-logitech-dj: fix off by one
There is a bug where a device with index 6 would write out of bounds in the array of paired devices. This patch fixes that problem. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Olivier Gay <ogay@logitech.com> Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-logitech-dj.h')
-rw-r--r--drivers/hid/hid-logitech-dj.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h
index 5982263acd73..fd28a5e0ca3b 100644
--- a/drivers/hid/hid-logitech-dj.h
+++ b/drivers/hid/hid-logitech-dj.h
@@ -27,6 +27,8 @@
27 27
28#define DJ_MAX_PAIRED_DEVICES 6 28#define DJ_MAX_PAIRED_DEVICES 6
29#define DJ_MAX_NUMBER_NOTIFICATIONS 8 29#define DJ_MAX_NUMBER_NOTIFICATIONS 8
30#define DJ_DEVICE_INDEX_MIN 1
31#define DJ_DEVICE_INDEX_MAX 6
30 32
31#define DJREPORT_SHORT_LENGTH 15 33#define DJREPORT_SHORT_LENGTH 15
32#define DJREPORT_LONG_LENGTH 32 34#define DJREPORT_LONG_LENGTH 32
@@ -94,7 +96,8 @@ struct dj_report {
94 96
95struct dj_receiver_dev { 97struct dj_receiver_dev {
96 struct hid_device *hdev; 98 struct hid_device *hdev;
97 struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES]; 99 struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
100 DJ_DEVICE_INDEX_MIN];
98 struct work_struct work; 101 struct work_struct work;
99 struct kfifo notif_fifo; 102 struct kfifo notif_fifo;
100 spinlock_t lock; 103 spinlock_t lock;