diff options
| author | Andy Shevchenko <[email protected]> | 2021-07-27 15:01:32 +0000 |
|---|---|---|
| committer | Petr Mladek <[email protected]> | 2021-07-29 07:52:33 +0000 |
| commit | fe8e3ee0d588566c1f44f28a555042ef50eba491 (patch) | |
| tree | a45d41c48935380439bac842d5d472458c3efc0c /fs/xfs/libxfs/xfs_alloc.c | |
| parent | Merge tag 'printk-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/... (diff) | |
| download | kernel-fe8e3ee0d588566c1f44f28a555042ef50eba491.tar.gz kernel-fe8e3ee0d588566c1f44f28a555042ef50eba491.zip | |
lib/test_scanf: Handle n_bits == 0 in random tests
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 <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Richard Fitzgerald <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
0 files changed, 0 insertions, 0 deletions
