From: syzbot <syzbot+3fa2af55f15bd21cada9@syzkaller.appspotmail.com>
To: xiaopei01@kylinos.cn
Cc: 67321ded.050a0220.a83d0.0016.gae@google.com,
linux-kernel@vger.kernel.org, xiaopei01@kylinos.cn,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [input?] [usb?] UBSAN: shift-out-of-bounds in s32ton
Date: Wed, 13 Nov 2024 18:20:01 -0800 [thread overview]
Message-ID: <67355e51.050a0220.1324f8.008d.GAE@google.com> (raw)
In-Reply-To: <6b1277a8-30a6-4d2b-9b25-93d105503ea3@kylinos.cn>
> s32ton always be 0 when n>=32,add check n.
>
> #syz test
This crash does not have a reproducer. I cannot test it.
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 81d6c734c8bc..ead1d338fa58 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -66,8 +66,11 @@ static s32 snto32(__u32 value, unsigned int n)
>
> static u32 s32ton(__s32 value, unsigned int n)
> {
> - s32 a = value >> (n - 1);
> + s32 a;
>
> + if (n >= 32)
> + return value;
> + a = value >> (n - 1);
> if (a && a != -1)
> return value < 0 ? 1 << (n - 1) : (1 << (n - 1)) - 1;
> return value & ((1 << n) - 1);
next prev parent reply other threads:[~2024-11-14 2:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 2:19 Pei Xiao
2024-11-14 2:20 ` syzbot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-11 15:08 syzbot
2024-11-13 14:59 ` xiaopeitux
2024-11-14 1:40 ` Pei Xiao
2024-11-14 1:40 ` Pei Xiao
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=67355e51.050a0220.1324f8.008d.GAE@google.com \
--to=syzbot+3fa2af55f15bd21cada9@syzkaller.appspotmail.com \
--cc=67321ded.050a0220.a83d0.0016.gae@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=xiaopei01@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®