diff options
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index b420f4a0fd28..8741d953dcc8 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -485,6 +485,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
485 | if (field->flags & HID_MAIN_ITEM_CONSTANT) | 485 | if (field->flags & HID_MAIN_ITEM_CONSTANT) |
486 | goto ignore; | 486 | goto ignore; |
487 | 487 | ||
488 | /* Ignore if report count is out of bounds. */ | ||
489 | if (field->report_count < 1) | ||
490 | goto ignore; | ||
491 | |||
488 | /* only LED usages are supported in output fields */ | 492 | /* only LED usages are supported in output fields */ |
489 | if (field->report_type == HID_OUTPUT_REPORT && | 493 | if (field->report_type == HID_OUTPUT_REPORT && |
490 | (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { | 494 | (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { |
@@ -1236,7 +1240,11 @@ static void report_features(struct hid_device *hid) | |||
1236 | 1240 | ||
1237 | rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; | 1241 | rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; |
1238 | list_for_each_entry(rep, &rep_enum->report_list, list) | 1242 | list_for_each_entry(rep, &rep_enum->report_list, list) |
1239 | for (i = 0; i < rep->maxfield; i++) | 1243 | for (i = 0; i < rep->maxfield; i++) { |
1244 | /* Ignore if report count is out of bounds. */ | ||
1245 | if (rep->field[i]->report_count < 1) | ||
1246 | continue; | ||
1247 | |||
1240 | for (j = 0; j < rep->field[i]->maxusage; j++) { | 1248 | for (j = 0; j < rep->field[i]->maxusage; j++) { |
1241 | /* Verify if Battery Strength feature is available */ | 1249 | /* Verify if Battery Strength feature is available */ |
1242 | hidinput_setup_battery(hid, HID_FEATURE_REPORT, rep->field[i]); | 1250 | hidinput_setup_battery(hid, HID_FEATURE_REPORT, rep->field[i]); |
@@ -1245,6 +1253,7 @@ static void report_features(struct hid_device *hid) | |||
1245 | drv->feature_mapping(hid, rep->field[i], | 1253 | drv->feature_mapping(hid, rep->field[i], |
1246 | rep->field[i]->usage + j); | 1254 | rep->field[i]->usage + j); |
1247 | } | 1255 | } |
1256 | } | ||
1248 | } | 1257 | } |
1249 | 1258 | ||
1250 | static struct hid_input *hidinput_allocate(struct hid_device *hid) | 1259 | static struct hid_input *hidinput_allocate(struct hid_device *hid) |