Re: [PATCH v1 1/1] lib/test_scanf: Handle n_bits == 0 in random tests

From: Petr Mladek
Date: Fri Jul 30 2021 - 06:46:07 EST


On Tue 2021-07-27 18:01:32, Andy Shevchenko wrote:
> UBSAN reported (via LKP)
>
> [ 11.021349][ T1] UBSAN: shift-out-of-bounds in lib/test_scanf.c:275:51
> [ 11.022782][ T1] shift exponent 32 is too large for 32-bit type 'unsigned int'
>
> When n_bits == 0, the shift is out of range. Switch code to use GENMASK
> to handle this case.
>
> Fixes: 50f530e176ea ("lib: test_scanf: Add tests for sscanf number conversion")
> Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

The patch is committed in linux/printk.git, branch for-5.15.

I would send it for 4.14 if there was another urgent fix needed.
But this one does not look important enough to hurry it up alone.

Best Regards,
Petr