Commit 3eba78d3 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

uniphier: fix memory over-run bug



Check the array index before the write.  This issue was found by a
static analysis tool.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 1502c4e1
...@@ -106,7 +106,8 @@ static int uniphier_nand_block_isbad(struct uniphier_nand *nand, int block) ...@@ -106,7 +106,8 @@ static int uniphier_nand_block_isbad(struct uniphier_nand *nand, int block)
is_bad = bbm != 0xff; is_bad = bbm != 0xff;
/* save the result for future re-use */ /* if possible, save the result for future re-use */
if (block < ARRAY_SIZE(nand->bbt))
nand->bbt[block] = is_bad; nand->bbt[block] = is_bad;
if (is_bad) if (is_bad)
......
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