Re: [PATCH RESEND] HID: fix error message in hid_open_report()
From: Jiri Kosina
Date: Tue Aug 20 2019 - 10:56:06 EST
On Mon, 22 Jul 2019, MichaÅ MirosÅaw wrote:
> On HID report descriptor parsing error the code displays bogus
> pointer instead of error offset (subtracts start=NULL from end).
> Make the message more useful by displaying correct error offset
> and include total buffer size for reference.
>
> This was carried over from ancient times - "Fixed" commit just
> promoted the message from DEBUG to ERROR.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 8c3d52fc393b ("HID: make parser more verbose about parsing errors by default")
> Signed-off-by: MichaÅ MirosÅaw <mirq-linux@xxxxxxxxxxxx>
[ ... snip ... ]
> @@ -1230,7 +1232,8 @@ int hid_open_report(struct hid_device *device)
> }
> }
>
> - hid_err(device, "item fetching failed at offset %d\n", (int)(end - start));
> + hid_err(device, "item fetching failed at offset %zu/%zu\n",
> + size - (end - start), size);
Hi Michal,
thanks for the fix.
This causes:
drivers/hid/hid-core.c: In function âhid_open_reportâ:
drivers/hid/hid-core.c:1235:2: warning: format â%zuâ expects argument of type âsize_tâ, but argument 4 has type âunsigned intâ [-Wformat=]
hid_err(device, "item fetching failed at offset %zu/%zu\n",
^
could you please fix that up and resubmit?
Thanks,
--
Jiri Kosina
SUSE Labs