mtd: nandsim: fix integer widening

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=b033e1aac9afd314add799b6cd2a5489f892757f
Commit:     b033e1aac9afd314add799b6cd2a5489f892757f
Parent:     c115add9d073752d38f6517882dfeafe76fc4458
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Mon Jul 21 19:07:44 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 19 11:53:08 2014 -0700

    mtd: nandsim: fix integer widening
    
    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 4f0d836..7dc1dd2 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;



More information about the linux-mtd-cvs mailing list