Commit d24030f0 authored by Adrian Bunk's avatar Adrian Bunk Committed by David Woodhouse

[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: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 03736155
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment