aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/readtest.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-07-21 22:07:12 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-08-19 14:53:08 -0400
commit1001ff7a4f64f3f4264e69d3ed70ff428f627e01 (patch)
tree9b673e00fda7873a9958cf5d60f66a49cf2e020c /drivers/mtd/tests/readtest.c
parent8c3f3f1d7941bcb25590b784f84accd7dcb44ba3 (diff)
mtd: tests: fix integer overflow issues
These multiplications are done with 32-bit arithmetic, then converted to 64-bit. We should widen the integers first to prevent overflow. This could be a problem for large (>4GB) MTD's. Detected by Coverity. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Akinobu Mita <akinobu.mita@gmail.com>
Diffstat (limited to 'drivers/mtd/tests/readtest.c')
-rw-r--r--drivers/mtd/tests/readtest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/tests/readtest.c b/drivers/mtd/tests/readtest.c
index 626e66d0f7e7..a54cf1511114 100644
--- a/drivers/mtd/tests/readtest.c
+++ b/drivers/mtd/tests/readtest.c
@@ -47,7 +47,7 @@ static int pgcnt;
47static int read_eraseblock_by_page(int ebnum) 47static int read_eraseblock_by_page(int ebnum)
48{ 48{
49 int i, ret, err = 0; 49 int i, ret, err = 0;
50 loff_t addr = ebnum * mtd->erasesize; 50 loff_t addr = (loff_t)ebnum * mtd->erasesize;
51 void *buf = iobuf; 51 void *buf = iobuf;
52 void *oobbuf = iobuf1; 52 void *oobbuf = iobuf1;
53 53