mtd: mtdswap: fix integer overflow
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Wed Oct 15 23:59:03 PDT 2014
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8c3f3f1d7941bcb25590b784f84accd7dcb44ba3
Commit: 8c3f3f1d7941bcb25590b784f84accd7dcb44ba3
Parent: 5e47212831ac565993d21ebd36216d98f2b58f30
Author: Brian Norris <computersforpeace at gmail.com>
AuthorDate: Mon Jul 21 19:07:02 2014 -0700
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 19 11:53:08 2014 -0700
mtd: mtdswap: fix integer overflow
Caught by Coverity.
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/mtdswap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index 0ec96cd..48cf6f9 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1474,7 +1474,7 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
}
eblocks = mtd_div_by_eb(use_size, mtd);
- use_size = eblocks * mtd->erasesize;
+ use_size = (uint64_t)eblocks * mtd->erasesize;
bad_blocks = mtdswap_badblocks(mtd, use_size);
eavailable = eblocks - bad_blocks;
More information about the linux-mtd-cvs
mailing list