[PATCH] mtd: spi_nor: Fixes out of bound shift

Michael Walle michael at walle.cc
Tue Jan 31 00:17:34 PST 2023


Hi,

Am 2023-01-26 15:26, schrieb lrannou at baylibre.com:
> From: Louis Rannou <lrannou at baylibre.com>
> 
> spi_nor_set_erase_type is called twice in sfdp.c with a null size. The
> return from ffs is 0 as well and the shift size becomes (2^32 - 1) 
> which is
> out of bound when applied to the << operator.
> 
> This considers as illegal a call to this function with null size. It
> creates a replacement spi_nor_mask_erase_type for explicit calls to 
> mask
> the erase type.
> 
> Signed-off-by: Louis Rannou <lrannou at baylibre.com>

There is also this thread with a pending patch:
https://lore.kernel.org/r/20211106075616.95401-1-tudor.ambarus@microchip.com/

-michael



More information about the linux-mtd mailing list