]> git.ipfire.org Git - thirdparty/linux.git/commit
HID: core: Fix size_t specifier in hid_report_raw_event()
authorNathan Chancellor <nathan@kernel.org>
Sun, 17 May 2026 04:51:01 +0000 (13:51 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 May 2026 20:05:41 +0000 (13:05 -0700)
commit4d3a2a466b8d68d852a1f3bbf11204b718428dc4
treef4536037d8711d8b00b4e56c75157cf4a7076991
parent4bf5d3da79c48e1df4bab82c9680c53adeff7820
HID: core: Fix size_t specifier in hid_report_raw_event()

When building for 32-bit platforms, for which 'size_t' is
'unsigned int', there are warnings around using the incorrect format
specifier to print bsize in hid_report_raw_event():

  drivers/hid/hid-core.c:2054:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
   2053 |                 hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
        |                                                                                         ~~~
        |                                                                                         %zu
   2054 |                                      report->id, csize, bsize);
        |                                                         ^~~~~
  drivers/hid/hid-core.c:2076:29: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
   2075 |                 hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
        |                                                                                          ~~~
        |                                                                                          %zu
   2076 |                                      report->id, rsize, bsize);
        |                                                         ^~~~~

Use the proper 'size_t' format specifier, '%zu', to clear up the
warnings.

Cc: stable@vger.kernel.org
Fixes: 2c85c61d1332 ("HID: pass the buffer size to hid_report_raw_event")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: https://lore.kernel.org/20260516020430.110135-1-ojeda@kernel.org/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/hid/hid-core.c