[bug report] mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

Christophe Kerello christophe.kerello at st.com
Tue Jul 21 08:20:39 EDT 2020


Hi Dan,

On 7/20/20 2:37 PM, dan.carpenter at oracle.com wrote:
> 1741  static int stm32_fmc2_nfc_parse_child(struct stm32_fmc2_nfc *nfc,
>    1742                                        struct device_node *dn)
>    1743  {
>    1744          struct stm32_fmc2_nand *nand = &nfc->nand;
>    1745          u32 cs;
>    1746          int ret, i;
>    1747
>    1748          if (!of_get_property(dn, "reg", &nand->ncs))
>    1749                  return -EINVAL;
>    1750
>    1751          nand->ncs /= sizeof(u32);
>    1752          if (!nand->ncs) {
>    1753                  dev_err(nfc->dev, "invalid reg property size\n");
>    1754                  return -EINVAL;
>    1755          }
>    1756
>    1757          for (i = 0; i < nand->ncs; i++) {
>    1758                  ret = of_property_read_u32_index(dn, "reg", i, &cs);
>    1759                  if (ret) {
>    1760                          dev_err(nfc->dev, "could not retrieve reg property: %d\n",
>    1761                                  ret);
>    1762                          return ret;
>    1763                  }
>    1764
>    1765                  if (cs > FMC2_MAX_CE) {
> 
> Which suggests that this should be >= FMC2_MAX_CE to prevent an off by
> one.

Thanks for reporting this issue.
A patch has been sent to solve it. 
(https://patchwork.ozlabs.org/project/linux-mtd/patch/1595325127-32693-1-git-send-email-christophe.kerello@st.com/)

Regards,
Christophe Kerello.



More information about the linux-mtd mailing list