diff options
author | davidcunado-arm <david.cunado@arm.com> | 2017-06-16 09:17:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-16 09:17:45 +0100 |
commit | 0dc3c353054896722b7cbfbd04a4d845619485e7 (patch) | |
tree | 0453a3c01944dfa8152968d26e524da15ecc8140 | |
parent | 3b6947ec55e4f26f4b1e9d2db7d57b63969f3569 (diff) | |
parent | 3eba78d3c81700a548e123cd14c1f9258696a606 (diff) |
Merge pull request #984 from masahir0y/uniphier
uniphier memory-overrun bug fix
-rw-r--r-- | plat/socionext/uniphier/uniphier_nand.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plat/socionext/uniphier/uniphier_nand.c b/plat/socionext/uniphier/uniphier_nand.c index acf6a740..88f906c2 100644 --- a/plat/socionext/uniphier/uniphier_nand.c +++ b/plat/socionext/uniphier/uniphier_nand.c @@ -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); |