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:
@@ -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;
|
||||
|
||||
|
مرجع در شماره جدید
Block a user