summaryrefslogtreecommitdiff
path: root/drivers/mtd/tests/stresstest.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-02-28 13:02:26 +0300
committerBrian Norris <computersforpeace@gmail.com>2015-03-12 01:21:47 +0300
commitb9da8bae416efda5ad61c7c92edbb30de15ff7ee (patch)
tree85278d8d43ad2db78971ed9de0cc08f5097c7014 /drivers/mtd/tests/stresstest.c
parent7f2a7ce17dcd381e366a65b6643239338a987715 (diff)
downloadlinux-b9da8bae416efda5ad61c7c92edbb30de15ff7ee.tar.xz
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/stresstest.c')
-rw-r--r--drivers/mtd/tests/stresstest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/tests/stresstest.c b/drivers/mtd/tests/stresstest.c
index c9d42cc2df1b..d90c1c01dac6 100644
--- a/drivers/mtd/tests/stresstest.c
+++ b/drivers/mtd/tests/stresstest.c
@@ -96,7 +96,7 @@ static int do_read(void)
if (offs + len > mtd->erasesize)
len = mtd->erasesize - offs;
}
- addr = eb * mtd->erasesize + offs;
+ addr = (loff_t)eb * mtd->erasesize + offs;
return mtdtest_read(mtd, addr, len, readbuf);
}
@@ -124,7 +124,7 @@ static int do_write(void)
offsets[eb + 1] = 0;
}
}
- addr = eb * mtd->erasesize + offs;
+ addr = (loff_t)eb * mtd->erasesize + offs;
err = mtdtest_write(mtd, addr, len, writebuf);
if (unlikely(err))
return err;