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

Louis Rannou lrannou at baylibre.com
Tue Jan 31 07:04:50 PST 2023


On 31/01/2023 09:17, Michael Walle wrote:
> 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/

Indeed, I did not see that.

My patch also misses the core.h update. Let's see if we get news from 
this pending patch. And then perhaps we'll see if I push a v2.


More information about the linux-mtd mailing list