summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_oobtest.c
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-07-31 16:21:01 +0200
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-09-04 09:40:17 +0100
commitc6f7e7beb9e6a64816f534a3a0dd0cfa4937f1fe (patch)
treec0fed3deeb9862dffac83ac45814e70341317c2e /drivers/mtd/tests/mtd_oobtest.c
parent269c0ee66367b11de9758ee64ea039843f0c7cad (diff)
downloadlinux-stable-c6f7e7beb9e6a64816f534a3a0dd0cfa4937f1fe.tar.gz
linux-stable-c6f7e7beb9e6a64816f534a3a0dd0cfa4937f1fe.tar.bz2
linux-stable-c6f7e7beb9e6a64816f534a3a0dd0cfa4937f1fe.zip
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>
Diffstat (limited to 'drivers/mtd/tests/mtd_oobtest.c')
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index a18e8d2f2557..5553cd4eab20 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -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 */