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>
此提交包含在:
@@ -364,7 +364,7 @@ static int __init mtd_nandbiterrs_init(void)
|
||||
|
||||
pr_info("Device uses %d subpages of %d bytes\n", subcount, subsize);
|
||||
|
||||
offset = page_offset * mtd->writesize;
|
||||
offset = (loff_t)page_offset * mtd->writesize;
|
||||
eraseblock = mtd_div_by_eb(offset, mtd);
|
||||
|
||||
pr_info("Using page=%u, offset=%llu, eraseblock=%u\n",
|
||||
|
新增問題並參考
封鎖使用者