summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-07-15 01:17:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-07-15 01:17:54 -0400
commitcb78623517ca08a035a3f69c0ca6d68a0123e649 (patch)
treed1163639cb0d467666e36dacf3a77e6c94bd6b2d
parenta2b2ed2ce20ae6c335a27ae5bf8580f385014e70 (diff)
downloadlwn-cb78623517ca08a035a3f69c0ca6d68a0123e649.tar.gz
lwn-cb78623517ca08a035a3f69c0ca6d68a0123e649.zip
Input: HID - fix potential out-of-bound array access
Fixes Coverity #id 978 Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/usb/input/hid-input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 028e1ad89f5d..7208839f2dbf 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -607,7 +607,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
}
- if (usage->hat_min < usage->hat_max || usage->hat_dir) {
+ if (usage->type == EV_ABS &&
+ (usage->hat_min < usage->hat_max || usage->hat_dir)) {
int i;
for (i = usage->code; i < usage->code + 2 && i <= max; i++) {
input_set_abs_params(input, i, -1, 1, 0, 0);