Skip to content

Commit

Permalink
Input: HID - fix potential out-of-bound array access
Browse files Browse the repository at this point in the history
Fixes Coverity #id 978

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Jul 15, 2006
1 parent a2b2ed2 commit cb78623
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/input/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cb78623

Please sign in to comment.