Skip to contentSkip to conversation

HID: core: demote warning to debug level

PATCH In review Ben Hutchings 2 participants 2 messages Aug 16 – Aug 24 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: core: demote warning to debug level

From: Matteo Croce <[email protected]>

The log level for short messages was changed from debug to warning, flooding syslog on systems with devices that regularly send short reports, in my case an UPS:

    $ dmesg |grep -c 'Event data for report .* was too short'
    35

Demote it back to debug level.

Fixes 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")

[bwh: Re-sending this fix which was applied and then lost in a mis-
merge. Add a second Fixes trailer so this should reach all stable branches that have the warning.]

Fixes 2c85c61d1332 ("HID: pass the buffer size to hid_report_raw_event")

---
This was originally posted at
<https://lore.kernel.org/linux-input/[email protected]/>
and applied to the hid tree as commit d0ff08d946c8, but then it was lost in merge commit aa776949fb77 "Merge branch 'for-7.2/wiimote' into for-linus".

Ben.

 drivers/hid/hid-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +2 -2
index cf123347a2af..605530ec2e9c 100644
@@ -2079,8 +2079,8 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
 		rsize = max_buffer_size;
 
 	if (bsize < rsize) {
-		hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
-				     report->id, rsize, bsize);
+		hid_dbg_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
+				    report->id, rsize, bsize);
 		return -EINVAL;
 	}
 
#1 lore raw
Quoted 20 lines · Ben Hutchings

From: Matteo Croce <[email protected]>

The log level for short messages was changed from debug to warning, flooding syslog on systems with devices that regularly send short reports, in my case an UPS:

    $ dmesg |grep -c 'Event data for report .* was too short'
    35

Demote it back to debug level.

Fixes 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing bogus memset()")

[bwh: Re-sending this fix which was applied and then lost in a mis-
merge. Add a second Fixes trailer so this should reach all stable branches that have the warning.]

Fixes 2c85c61d1332 ("HID: pass the buffer size to hid_report_raw_event")
Quoted 6 lines

---
This was originally posted at
<https://lore.kernel.org/linux-input/[email protected]/>
and applied to the hid tree as commit d0ff08d946c8, but then it was lost in merge commit aa776949fb77 "Merge branch 'for-7.2/wiimote' into for-linus".

Sorry, but, NACK.

See the discussion with Lee ATM on the LKML[0]

That intermediate "fix" was wrong and got merged while I was working on a proper solution, which is now upstream.

Cheers,
Benjamin

[0] https://lore.kernel.org/linux-input/aoxcpDR8jnuUA1nF@beelink/T/#t

Quoted 21 lines

Ben.

 drivers/hid/hid-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +2 -2
index cf123347a2af..605530ec2e9c 100644
@@ -2079,8 +2079,8 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
                rsize = max_buffer_size;
 
        if (bsize < rsize) {
-               hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
-                                    report->id, rsize, bsize);
+               hid_dbg_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
+                                   report->id, rsize, bsize);
                return -EINVAL;
        }