* [PATCH] mtd: rawnand: stm32_fmc2: fix a buffer overflow
@ 2020-07-21 9:52 Christophe Kerello
2020-09-07 7:22 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Kerello @ 2020-07-21 9:52 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr
Cc: linux-mtd, linux-kernel, linux-stm32, dan.carpenter, Christophe Kerello
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: 2cd457f328c1 ("mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver")
---
drivers/mtd/nand/raw/stm32_fmc2_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index a4140af..74fecde 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -1791,7 +1791,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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: rawnand: stm32_fmc2: fix a buffer overflow
2020-07-21 9:52 [PATCH] mtd: rawnand: stm32_fmc2: fix a buffer overflow Christophe Kerello
@ 2020-09-07 7:22 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2020-09-07 7:22 UTC (permalink / raw)
To: Christophe Kerello, miquel.raynal, richard, vigneshr
Cc: linux-mtd, linux-kernel, dan.carpenter, linux-stm32
On Tue, 2020-07-21 at 09:52:07 UTC, Christophe Kerello wrote:
> 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: 2cd457f328c1 ("mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver")
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-07 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 9:52 [PATCH] mtd: rawnand: stm32_fmc2: fix a buffer overflow Christophe Kerello
2020-09-07 7:22 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).