]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: rawnand: stm32_fmc2: fix a buffer overflow
authorChristophe Kerello <christophe.kerello@st.com>
Fri, 31 Jul 2020 07:53:34 +0000 (09:53 +0200)
committerPatrice Chotard <patrice.chotard@st.com>
Thu, 13 Aug 2020 07:53:34 +0000 (09:53 +0200)
The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
drivers/mtd/nand/raw/stm32_fmc2_nand.c

index 3306bd8ac94a460e24e395cdc21d45cae5c08e8c..2929acf66dd2cd831d769cdb08795a4131998cf5 100644 (file)
@@ -846,7 +846,7 @@ static int stm32_fmc2_parse_child(struct stm32_fmc2_nfc *fmc2,
        }
 
        for (i = 0; i < nand->ncs; i++) {
-               if (cs[i] > FMC2_MAX_CE) {
+               if (cs[i] >= FMC2_MAX_CE) {
                        pr_err("Invalid reg value: %d\n",
                               nand->cs_used[i]);
                        return -EINVAL;