Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d24030f0f71390b1a01796d664445352bd403269
Commit:     d24030f0f71390b1a01796d664445352bd403269
Parent:     0373615579c7359dfd0bc66139c2e7bf67793480
Author:     Adrian Bunk <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 2 15:29:19 2007 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Fri Feb 9 15:06:02 2007 +0000

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 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 1b9fa05..ea5c849 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] = {
 
 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)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to