Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)