UBSAN: shift-out-of-bounds in drivers/mtd/spi-nor/core.c

Stein, Alexander Alexander.Stein at tq-group.com
Fri Nov 5 07:48:38 PDT 2021


Hi,

running on linux-next-20211101 I get the following UBSAN message during
boot on my board having mt25qu512a mounted:
> UBSAN: shift-out-of-bounds in drivers/mtd/spi-nor/core.c:2237:24
> shift exponent 4294967295 is too large for 32-bit type 'int'

Using some debug output I could track it down to sfdp.c passing 0 for
size. This will cause an underflow for 'ffs(erase->size) - 1'.
I'm not sure what size_mask is used for, so I don't know how to fix it.
But better to let you know at least.

Best regards,
Alexander



More information about the linux-mtd mailing list