From: sashiko-bot@kernel.org
To: yaolu@kylinos.cn
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] HID: core: Fix bsize printk specifier in hid_report_raw_event()
Date: Fri, 22 May 2026 07:31:38 +0000 [thread overview]
Message-ID: <20260522073138.A96C91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260522072718.186707-1-yaolu@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect format specifier for the `size_t` variable `bsize`. The patch replaces `%ld` with `%u` to fix a warning on 32-bit architectures (where `size_t` is `unsigned int`), but this introduces a new warning on 64-bit architectures (where `size_t` is `unsigned long`). The correct format specifier for `size_t` is `%zu`.
--
commit d6a5fb9c76c9718771a50e1f79f29b3df496f869
Author: Lu Yao <yaolu@kylinos.cn>
HID: core: Fix bsize printk specifier in hid_report_raw_event()
This commit attempts to fix a build warning on 32-bit architectures by
changing the format specifier for a size_t variable from %ld to %u.
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index b3596851c7191..c21c58d7bf02b 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2050,7 +2050,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
> return 0;
>
> if (unlikely(bsize < csize)) {
> - hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %ld)\n",
> + hid_warn_ratelimited(hid, "Event data for report %d is incorrect (%d vs %u)\n",
[Severity: Low]
Will this cause a new format string warning on 64-bit architectures? bsize is
of type size_t, which is an unsigned long on 64-bit systems. Should this use
the %zu format specifier instead to be portable across both 32-bit and 64-bit
architectures?
> report->id, csize, bsize);
> return -EINVAL;
> }
[ ... ]
> @@ -2072,7 +2072,7 @@ 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 %ld)\n",
> + hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %u)\n",
[Severity: Low]
Similarly here, should this also use %zu for the size_t variable bsize?
> report->id, rsize, bsize);
> return -EINVAL;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260522072718.186707-1-yaolu@kylinos.cn?part=1
next prev parent reply other threads:[~2026-05-22 7:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 7:27 [PATCH] HID: core: Fix bsize printk specifier in hid_report_raw_event() yaolu
2026-05-22 7:31 ` sashiko-bot [this message]
2026-05-22 8:46 ` Benjamin Tissoires
2026-05-24 1:03 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522073138.A96C91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yaolu@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.