mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 02:45:33 +00:00
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: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
@@ -106,8 +106,9 @@ static int uniphier_nand_block_isbad(struct uniphier_nand *nand, int block)
|
||||
|
||||
is_bad = bbm != 0xff;
|
||||
|
||||
/* save the result for future re-use */
|
||||
nand->bbt[block] = is_bad;
|
||||
/* if possible, save the result for future re-use */
|
||||
if (block < ARRAY_SIZE(nand->bbt))
|
||||
nand->bbt[block] = is_bad;
|
||||
|
||||
if (is_bad)
|
||||
WARN("found bad block at %d. skip.\n", block);
|
||||
|
||||
Reference in New Issue
Block a user