* [PATCH] mtd: nandsim: fix integer widening
@ 2014-07-22 2:07 Brian Norris
0 siblings, 0 replies; only message in thread
From: Brian Norris @ 2014-07-22 2:07 UTC (permalink / raw)
To: linux-mtd; +Cc: Brian Norris
This multiplication should be done in 64-bit, not 32-bit.
Caught by Coverity.
Signed-off-by: Brian Norris <computersforpeace@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-07-22 2:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-22 2:07 [PATCH] mtd: nandsim: fix integer widening Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).