Re: [PATCH] fix UBSAN splat in test_scanf

From: Andy Shevchenko
Date: Tue Aug 10 2021 - 09:31:45 EST


On Mon, Aug 09, 2021 at 06:20:13AM -0400, Chris von Recklinghausen wrote:

Thanks for the report and fix!

First of all, have you seen this:
https://lore.kernel.org/lkml/20210727150132.28920-1-andriy.shevchenko@xxxxxxxxxxxxxxx/T/#u
?

> On a system with CONFIG_UBSAN_SHIFT=y, the following splat was observed:

> [ 104.676826] test_scanf: loaded.
> [ 104.680862] ================================================================================
> [ 104.690304] UBSAN: shift-out-of-bounds in lib/test_scanf.c:274:51
> [ 104.697144] shift exponent 32 is too large for 32-bit type 'unsigned int'

As you may see in the above the rule of thumb is to include only meaningful
parts of the oops.

--
With Best Regards,
Andy Shevchenko