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>
This commit is contained in:
Brian Norris
2014-07-21 19:07:12 -07:00
والد 8c3f3f1d79
کامیت 1001ff7a4f
7فایلهای تغییر یافته به همراه22 افزوده شده و 22 حذف شده

مشاهده پرونده

@@ -47,7 +47,7 @@ static int pgcnt;
static int read_eraseblock_by_page(int ebnum)
{
int i, ret, err = 0;
loff_t addr = ebnum * mtd->erasesize;
loff_t addr = (loff_t)ebnum * mtd->erasesize;
void *buf = iobuf;
void *oobbuf = iobuf1;