diff options
author | Adrian Bunk <bunk@stusta.de> | 2007-02-02 09:29:19 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-02-09 10:06:02 -0500 |
commit | d24030f0f71390b1a01796d664445352bd403269 (patch) | |
tree | fc993b1618c48aa6525750b70fc5ffd48f476d02 | |
parent | 0373615579c7359dfd0bc66139c2e7bf67793480 (diff) |
[MTD] [NAND] Fix an off-by-one in a BUG_ON in CAFÉ ECC correction.
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>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | drivers/mtd/nand/cafe_ecc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/cafe_ecc.c b/drivers/mtd/nand/cafe_ecc.c index 1b9fa05a4474..ea5c8491d2c5 100644 --- a/drivers/mtd/nand/cafe_ecc.c +++ b/drivers/mtd/nand/cafe_ecc.c | |||
@@ -1045,7 +1045,7 @@ static unsigned short err_pos_lut[4096] = { | |||
1045 | 1045 | ||
1046 | static unsigned short err_pos(unsigned short din) | 1046 | static unsigned short err_pos(unsigned short din) |
1047 | { | 1047 | { |
1048 | BUG_ON(din > 4096); | 1048 | BUG_ON(din >= ARRAY_SIZE(err_pos_lut)); |
1049 | return err_pos_lut[din]; | 1049 | return err_pos_lut[din]; |
1050 | } | 1050 | } |
1051 | static int chk_no_err_only(unsigned short *chk_syndrome_list, unsigned short *err_info) | 1051 | static int chk_no_err_only(unsigned short *chk_syndrome_list, unsigned short *err_info) |