[PATCH 01/11] mtd: rawnand: stm32_fmc2: fix a buffer overflow

Patrice CHOTARD patrice.chotard at st.com
Thu Aug 13 09:27:23 CEST 2020


Hi Christpohe

On 7/31/20 9:53 AM, Christophe Kerello wrote:
> The chip select defined in the device tree could only be 0 or 1.
>
> Signed-off-by: Christophe Kerello <christophe.kerello at st.com>
> ---
>
>  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 3306bd8..2929acf 100644
> --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
> +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
> @@ -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;

Reviewed-by: Patrice Chotard <patrice.chotard at st.com>

Thanks

Patrice


More information about the U-Boot mailing list