From: Dmitry Torokhov Date: Sat, 15 Jul 2006 05:17:54 +0000 (-0400) Subject: Input: HID - fix potential out-of-bound array access X-Git-Tag: v2.6.18-rc4~1^2~15 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb78623517ca08a035a3f69c0ca6d68a0123e649;p=linux-2.6 Input: HID - fix potential out-of-bound array access Fixes Coverity #id 978 Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 028e1ad89f..7208839f2d 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);