Skip to content

Commit 4d3a2a4

Browse files
nathanchancetorvalds
authored andcommitted
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: 2c85c61 ("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>
1 parent 4bf5d3d commit 4d3a2a4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/hid/hid-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
20502050
return 0;
20512051

20522052
if (unlikely(bsize < csize)) {
2053-
hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
2053+
hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %zu)\n",
20542054
report->id, csize, bsize);
20552055
return -EINVAL;
20562056
}
@@ -2072,7 +2072,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
20722072
rsize = max_buffer_size;
20732073

20742074
if (bsize < rsize) {
2075-
hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %ld)\n",
2075+
hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %zu)\n",
20762076
report->id, rsize, bsize);
20772077
return -EINVAL;
20782078
}

0 commit comments

Comments
 (0)