From: Nathan Chancellor <nathan@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Johan Hovold <johan@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>
Subject: Re: [PATCH] HID: core: Fix size_t specifier in hid_report_raw_event()
Date: Mon, 18 May 2026 12:08:37 -0700 [thread overview]
Message-ID: <20260518190837.GA2318678@ax162> (raw)
In-Reply-To: <CAMuHMdVzWL0WZe6u-uY2U+uCNUKB1aNTYM3kaYkX=OJBCY9G0w@mail.gmail.com>
Hi Geert,
On Mon, May 18, 2026 at 11:10:49AM +0200, Geert Uytterhoeven wrote:
> On Sun, 17 May 2026 at 06:51, Nathan Chancellor <nathan@kernel.org> wrote:
> > --- 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 %zu)\n",
> > report->id, csize, bsize);
>
> Both report->id and csize are unsigned, so should use %u.
>
> > 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 %zu)\n",
> > report->id, rsize, bsize);
>
> Same here.
>
> > return -EINVAL;
> > }
>
> And more incorrect %d outside the context!
Yeah, I had noticed this as well but I decided to keep the patch
contained to only address the instances that the compiler warned about.
I do think this is worth addressing in a follow up patch, which either I
or the HID maintainers can do.
Thanks for the review!
Cheers,
Nathan
prev parent reply other threads:[~2026-05-18 19:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 4:51 [PATCH] HID: core: Fix size_t specifier in hid_report_raw_event() Nathan Chancellor
2026-05-18 9:10 ` Geert Uytterhoeven
2026-05-18 19:08 ` Nathan Chancellor [this message]
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=20260518190837.GA2318678@ax162 \
--to=nathan@kernel.org \
--cc=bentiss@kernel.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=jikos@kernel.org \
--cc=johan@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox