aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-08-03 16:45:41 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-15 16:37:14 +1000
commit05f0ffdcd5a955acab3473185aa52a3d88909b39 (patch)
treeea6dfa29b46e8f5f786fe9d747ffc6e29696b3ac
parent675fa87681155b1d3976c1dead5a4d7b078a80c6 (diff)
downloadskiboot-05f0ffdcd5a955acab3473185aa52a3d88909b39.zip
skiboot-05f0ffdcd5a955acab3473185aa52a3d88909b39.tar.gz
skiboot-05f0ffdcd5a955acab3473185aa52a3d88909b39.tar.bz2
libflash/mbox-flash: Fix unintentional integer overflow (CID 142226)
Fixes: CID 142226 (#1 of 1): overflow_before_widen: Potentially overflowing expression `1 << mbox_flash->shift` with type int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned). Fixes: CID 142226 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--libflash/mbox-flash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 7491d3b..950e24f 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -141,9 +141,9 @@ static int lpc_window_write(struct mbox_flash_data *mbox_flash, uint32_t pos,
return 0;
}
-__unused static uint64_t mbox_flash_mask(struct mbox_flash_data *mbox_flash)
+static uint64_t mbox_flash_mask(struct mbox_flash_data *mbox_flash)
{
- return (1 << mbox_flash->shift) - 1;
+ return (1ULL << mbox_flash->shift) - 1;
}
__unused static uint8_t msg_get_u8(struct bmc_mbox_msg *msg, int i)