Hi!
From: Tomasz Pakuła forest10pl@gmail.com
[ Upstream commit 22a05462c3d0eee15154faf8d13c49e6295270a5 ]
This function triggered a null pointer dereference if used to search for a report that isn't implemented on the device. This happened both for optional and required reports alike.
Ok.
+++ b/drivers/hid/usbhid/hid-pidff.c @@ -770,6 +770,11 @@ static void pidff_set_autocenter(struct input_dev *dev, u16 magnitude) static int pidff_find_fields(struct pidff_usage *usage, const u8 *table, struct hid_report *report, int count, int strict) {
- if (!report) {
pr_debug("pidff_find_fields, null report\n");
return -1;
- }
- int i, j, k, found;
for (k = 0; k < count; k++) { @@ -883,6 +888,11 @@ static int pidff_reports_ok(struct pidff_device *pidff) static struct hid_field *pidff_find_special_field(struct hid_report *report, int usage, int enforce_min) {
- if (!report) {
pr_debug("pidff_find_special_field, null report\n");
return NULL;
- }
- int i;
But this is quite strange. Normally declarations go first. Not sure if old compilers can handle this?
Best regards, Pavel