mtd: rawnand: stm32_fmc2: fix a buffer overflow
This patch solves following static checker warning:
drivers/mtd/nand/raw/stm32_fmc2_nand.c:350 stm32_fmc2_nfc_select_chip()
error: buffer overflow 'nfc->data_phys_addr' 2 <= 2
The CS value can only be 0 or 1.
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Fixes: 2cd457f328
("mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/1595325127-32693-1-git-send-email-christophe.kerello@st.com
This commit is contained in:
Родитель
4bc0224323
Коммит
ab16f54ef3
|
@ -1763,7 +1763,7 @@ static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (cs > FMC2_MAX_CE) {
|
||||
if (cs >= FMC2_MAX_CE) {
|
||||
dev_err(nfc->dev, "invalid reg value: %d\n", cs);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче