diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index a056850328ef..c5207ed5d65b 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1112,6 +1112,9 @@ static s32 snto32(__u32 value, unsigned n) if (!value || !n) return 0; + if (n > 32) + n = 32; + switch (n) { case 8: return ((__s8)value); case 16: return ((__s16)value);