提交 d24030f0 编写于 作者: A Adrian Bunk 提交者: 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: NAdrian Bunk <bunk@stusta.de>
Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册