From: David Brownell <david-b@pacbell.net>
To: Linux MTD <linux-mtd@lists.infradead.org>
Cc: dwmw2@infradead.org, Thomas Gleixner <tglx@linutronix.de>,
"Narnakaje, Snehaprabha" <nsnehaprabha@ti.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [patch/RESEND 2.6.30-rc2 1/3] NAND: don't walk past end of oobfree[]
Date: Tue, 21 Apr 2009 19:51:20 -0700 [thread overview]
Message-ID: <200904211951.21270.david-b@pacbell.net> (raw)
From: David Brownell <dbrownell@users.sourceforge.net>
Resolve issue noted by Sneha: when computing oobavail from
the list of free areas in the OOB, don't assume there will
always be an unused slot at the end. With ECC_HW_SYNDROME
and 4KB page chips, it's fairly likely there *won't* be one.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: "Narnakaje, Snehaprabha" <nsnehaprabha@ti.com>"
---
RESEND refreshed 7-april version.
Still seems appropriate for a 2.6.30-rc merge.
drivers/mtd/nand/nand_base.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2756,7 +2756,8 @@ int nand_scan_tail(struct mtd_info *mtd)
* the out of band area
*/
chip->ecc.layout->oobavail = 0;
- for (i = 0; chip->ecc.layout->oobfree[i].length; i++)
+ for (i = 0; chip->ecc.layout->oobfree[i].length
+ && i < ARRAY_SIZE(chip->ecc.layout->oobfree); i++)
chip->ecc.layout->oobavail +=
chip->ecc.layout->oobfree[i].length;
mtd->oobavail = chip->ecc.layout->oobavail;
next reply other threads:[~2009-04-22 3:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-22 2:51 David Brownell [this message]
2009-04-22 7:45 ` [patch/RESEND 2.6.30-rc2 1/3] NAND: don't walk past end of oobfree[] Artem Bityutskiy
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=200904211951.21270.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nsnehaprabha@ti.com \
--cc=tglx@linutronix.de \
/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