Browse Source

Input: HID - fix potential out-of-bound array access

Fixes Coverity #id 978

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Dmitry Torokhov 19 years ago
parent
commit
cb78623517
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/usb/input/hid-input.c

+ 2 - 1
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);