From: syzbot <syzbot+b63d677d63bcac06cf90@syzkaller.appspotmail.com>
To: lanbincn@hotmail.com
Cc: lanbincn@hotmail.com, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH 6.1.y] HID: core: Harden s32ton() against conversion to 0 bits
Date: Tue, 02 Dec 2025 23:31:03 -0800 [thread overview]
Message-ID: <692fe737.a70a0220.2ea503.00cd.GAE@google.com> (raw)
In-Reply-To: <TY3P301MB065899BB05E5C334025F7963C4D9A@TY3P301MB0658.JPNP301.PROD.OUTLOOK.COM>
> #syz test:
This bug is already marked as fixed. No point in testing.
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y
>
> drivers/hid/hid-core.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index ed65523d77c2..c8cca0c7ec67 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1354,7 +1354,12 @@ EXPORT_SYMBOL_GPL(hid_snto32);
>
> static u32 s32ton(__s32 value, unsigned n)
> {
> - s32 a = value >> (n - 1);
> + s32 a;
> + if (!value || !n)
> + return 0;
> +
> + a = value >> (n - 1);
> +
> if (a && a != -1)
> return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
> return value & ((1 << n) - 1);
> --
> 2.43.0
>
>
parent reply other threads:[~2025-12-03 7:31 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <TY3P301MB065899BB05E5C334025F7963C4D9A@TY3P301MB0658.JPNP301.PROD.OUTLOOK.COM>]
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=692fe737.a70a0220.2ea503.00cd.GAE@google.com \
--to=syzbot+b63d677d63bcac06cf90@syzkaller.appspotmail.com \
--cc=lanbincn@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/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