Merge pull request #984 from masahir0y/uniphier

uniphier memory-overrun bug fix
This commit is contained in:
davidcunado-arm 2017-06-16 09:17:45 +01:00 committed by GitHub
commit 0dc3c35305
1 changed files with 3 additions and 2 deletions

View File

@ -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);