mtd: tests: fix read buffer overflows
Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:

committed by
David Woodhouse

parent
269c0ee663
commit
c6f7e7beb9
@@ -512,7 +512,7 @@ static int __init mtd_oobtest_init(void)
|
||||
goto out;
|
||||
|
||||
addr0 = 0;
|
||||
for (i = 0; bbt[i] && i < ebcnt; ++i)
|
||||
for (i = 0; i < ebcnt && bbt[i]; ++i)
|
||||
addr0 += mtd->erasesize;
|
||||
|
||||
/* Attempt to write off end of OOB */
|
||||
|
Reference in New Issue
Block a user