diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-02-28 11:02:26 +0100 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-03-11 23:21:47 +0100 |
commit | b9da8bae416efda5ad61c7c92edbb30de15ff7ee (patch) | |
tree | 85278d8d43ad2db78971ed9de0cc08f5097c7014 /drivers/mtd/tests/subpagetest.c | |
parent | mtd: onenand: drop dead code (diff) | |
download | linux-b9da8bae416efda5ad61c7c92edbb30de15ff7ee.tar.xz linux-b9da8bae416efda5ad61c7c92edbb30de15ff7ee.zip |
mtd: tests: fix more potential integer overflows
Caught by Coverity (CID #200625 and others)
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Diffstat (limited to 'drivers/mtd/tests/subpagetest.c')
-rw-r--r-- | drivers/mtd/tests/subpagetest.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c index 7b59ef522d5e..0b835c631f91 100644 --- a/drivers/mtd/tests/subpagetest.c +++ b/drivers/mtd/tests/subpagetest.c @@ -95,7 +95,7 @@ static int write_eraseblock2(int ebnum) loff_t addr = (loff_t)ebnum * mtd->erasesize; for (k = 1; k < 33; ++k) { - if (addr + (subpgsize * k) > (ebnum + 1) * mtd->erasesize) + if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) break; prandom_bytes_state(&rnd_state, writebuf, subpgsize * k); err = mtd_write(mtd, addr, subpgsize * k, &written, writebuf); @@ -195,7 +195,7 @@ static int verify_eraseblock2(int ebnum) loff_t addr = (loff_t)ebnum * mtd->erasesize; for (k = 1; k < 33; ++k) { - if (addr + (subpgsize * k) > (ebnum + 1) * mtd->erasesize) + if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) break; prandom_bytes_state(&rnd_state, writebuf, subpgsize * k); clear_data(readbuf, subpgsize * k); |