Re: HID: core: Harden s32ton() against conversion to 0 bits

6 views
Skip to first unread message

syzbot

unread,
Dec 3, 2025, 1:44:33 AM (yesterday) Dec 3
to lanb...@hotmail.com, lanb...@hotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
> #syz test: git://pek-git.wrs.com/external/linux-stable.git linux-6.1.y

This bug is already marked as fixed. No point in testing.

syzbot

unread,
Dec 3, 2025, 2:31:05 AM (yesterday) Dec 3
to lanb...@hotmail.com, lanb...@hotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.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
>
>
Reply all
Reply to author
Forward
0 new messages