hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/hid/hid-betopff.c
....@@ -60,7 +60,6 @@
6060 struct list_head *report_list =
6161 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
6262 struct input_dev *dev;
63
- int field_count = 0;
6463 int error;
6564 int i, j;
6665
....@@ -86,17 +85,19 @@
8685 * -----------------------------------------
8786 * Do init them with default value.
8887 */
88
+ if (report->maxfield < 4) {
89
+ hid_err(hid, "not enough fields in the report: %d\n",
90
+ report->maxfield);
91
+ return -ENODEV;
92
+ }
8993 for (i = 0; i < report->maxfield; i++) {
94
+ if (report->field[i]->report_count < 1) {
95
+ hid_err(hid, "no values in the field\n");
96
+ return -ENODEV;
97
+ }
9098 for (j = 0; j < report->field[i]->report_count; j++) {
9199 report->field[i]->value[j] = 0x00;
92
- field_count++;
93100 }
94
- }
95
-
96
- if (field_count < 4) {
97
- hid_err(hid, "not enough fields in the report: %d\n",
98
- field_count);
99
- return -ENODEV;
100101 }
101102
102103 betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);