public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 6.1.y] HID: core: Harden s32ton() against conversion to 0 bits
       [not found] <TY3P301MB065899BB05E5C334025F7963C4D9A@TY3P301MB0658.JPNP301.PROD.OUTLOOK.COM>
@ 2025-12-03  7:31 ` syzbot
  0 siblings, 0 replies; only message in thread
From: syzbot @ 2025-12-03  7:31 UTC (permalink / raw)
  To: lanbincn; +Cc: lanbincn, linux-kernel, syzkaller-bugs

> #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
>
>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-03  7:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <TY3P301MB065899BB05E5C334025F7963C4D9A@TY3P301MB0658.JPNP301.PROD.OUTLOOK.COM>
2025-12-03  7:31 ` [PATCH 6.1.y] HID: core: Harden s32ton() against conversion to 0 bits syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox