aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-07-21 22:08:03 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-08-19 14:53:09 -0400
commit537ab1bd47d6518e8a40207a80dd0c2c4bc43aed (patch)
tree636bff54331b59d6e784ea5ce68fd548f3eb3904 /drivers/mtd
parent7a6f43958a53020f85818ff5c895623e88781fd6 (diff)
mtd: nand: fix integer widening problems
chip->pagebuf is a 32-bit type (int), so the shift will only be applied as 32-bit. Fix this for 64-bit safety. Caught by Coverity. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 1a27c2da29ff..ae6e7c47f8e2 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2409,8 +2409,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
2409 blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1; 2409 blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;
2410 2410
2411 /* Invalidate the page cache, when we write to the cached page */ 2411 /* Invalidate the page cache, when we write to the cached page */
2412 if (to <= (chip->pagebuf << chip->page_shift) && 2412 if (to <= ((loff_t)chip->pagebuf << chip->page_shift) &&
2413 (chip->pagebuf << chip->page_shift) < (to + ops->len)) 2413 ((loff_t)chip->pagebuf << chip->page_shift) < (to + ops->len))
2414 chip->pagebuf = -1; 2414 chip->pagebuf = -1;
2415 2415
2416 /* Don't allow multipage oob writes with offset */ 2416 /* Don't allow multipage oob writes with offset */