From: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
To: linux-mtd@lists.infradead.org
Cc: boris.brezillon@free-electrons.com, computersforpeace@gmail.com,
oss@buserror.net, leoyang.li@nxp.com,
Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Subject: [PATCH] driver: mtd: ifc: increase eccstat array size for ver >= 2.0.0
Date: Wed, 7 Mar 2018 14:46:56 +0530 [thread overview]
Message-ID: <20180307091656.16378-1-prabhakar.kushwaha@nxp.com> (raw)
Number of ECC status registers i.e. (ECCSTATx) has been increased
in IFC version 2.0.0 due to increase in SRAM size.
Fix the resulting eccstat array overflow.
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
---
drivers/mtd/nand/fsl_ifc_nand.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 4872a7ba6503..612f0990fa90 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -193,7 +193,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
- u32 eccstat[4];
+ u32 eccstat[8];
int i;
/* set the chip select for NAND Transaction */
@@ -237,8 +237,14 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
else
eccstat_regs = ifc->ifc_nand.v1_nand_eccstat;
- for (i = sector / 4; i <= sector_end / 4; i++)
+ for (i = sector / 4; i <= sector_end / 4; i++) {
+ if (i >= ARRAY_SIZE(eccstat)) {
+ dev_err(priv->dev, "%s: eccstat small for %d\n",
+ __func__, i);
+ return;
+ }
eccstat[i] = ifc_in32(&eccstat_regs[i]);
+ }
for (i = sector; i <= sector_end; i++) {
errors = check_read_ecc(mtd, ctrl, eccstat, i);
--
2.14.1
next reply other threads:[~2018-03-07 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 9:16 Prabhakar Kushwaha [this message]
2018-03-07 9:46 ` [PATCH] driver: mtd: ifc: increase eccstat array size for ver >= 2.0.0 Miquel Raynal
2018-03-07 10:17 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180307091656.16378-1-prabhakar.kushwaha@nxp.com \
--to=prabhakar.kushwaha@nxp.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=leoyang.li@nxp.com \
--cc=linux-mtd@lists.infradead.org \
--cc=oss@buserror.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox