Skip to content

Commit 4d14fc2

Browse files
Christophe Kerellogregkh
authored andcommitted
mtd: rawnand: stm32_fmc2: fix a buffer overflow
[ Upstream commit ab16f54 ] 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: 2cd457f ("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 50415e6 commit 4d14fc2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/mtd/nand/raw/stm32_fmc2_nand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc,
17621762
return ret;
17631763
}
17641764

1765-
if (cs > FMC2_MAX_CE) {
1765+
if (cs >= FMC2_MAX_CE) {
17661766
dev_err(nfc->dev, "invalid reg value: %d\n", cs);
17671767
return -EINVAL;
17681768
}

0 commit comments

Comments
 (0)