From: Adrian Bunk <bunk@stusta.de>
To: dwmw2@infradead.org
Cc: linux-mtd@lists.infradead.org
Subject: [2.6 patch] drivers/mtd/nand/cafe_ecc.c: fix an off-by-one in a BUG_ON
Date: Fri, 2 Feb 2007 15:29:19 +0100 [thread overview]
Message-ID: <20070202142919.GE3754@stusta.de> (raw)
err_pos_lut[4096] of an array with 4096 elements is a bug.
Spotted by the Coverity checker.
While I was at it, I also converted it to ARRAY_SIZE().
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.20-rc6-mm3/drivers/mtd/nand/cafe_ecc.c.old 2007-02-02 14:45:13.000000000 +0100
+++ linux-2.6.20-rc6-mm3/drivers/mtd/nand/cafe_ecc.c 2007-02-02 14:45:42.000000000 +0100
@@ -1045,7 +1045,7 @@
static unsigned short err_pos(unsigned short din)
{
- BUG_ON(din > 4096);
+ BUG_ON(din >= ARRAY_SIZE(err_pos_lut));
return err_pos_lut[din];
}
static int chk_no_err_only(unsigned short *chk_syndrome_list, unsigned short *err_info)
next reply other threads:[~2007-02-02 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-02 14:29 Adrian Bunk [this message]
2007-02-09 15:06 ` [2.6 patch] drivers/mtd/nand/cafe_ecc.c: fix an off-by-one in a BUG_ON David Woodhouse
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=20070202142919.GE3754@stusta.de \
--to=bunk@stusta.de \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/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