mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 23:04:50 +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:
parent
1502c4e157
commit
3eba78d3c8
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue