[PATCH] mtd: nandsim: fix integer widening
Brian Norris
computersforpeace at gmail.com
Mon Jul 21 19:07:44 PDT 2014
This multiplication should be done in 64-bit, not 32-bit.
Caught by Coverity.
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/nandsim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 4f0d83648e5a..7dc1dd28d896 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -827,7 +827,7 @@ static int parse_badblocks(struct nandsim *ns, struct mtd_info *mtd)
NS_ERR("invalid badblocks.\n");
return -EINVAL;
}
- offset = erase_block_no * ns->geom.secsz;
+ offset = (loff_t)erase_block_no * ns->geom.secsz;
if (mtd_block_markbad(mtd, offset)) {
NS_ERR("invalid badblocks.\n");
return -EINVAL;
--
1.9.1
More information about the linux-mtd
mailing list