Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34373 )
Change subject: drivers/spi: Use 64 bits in multiplication ......................................................................
drivers/spi: Use 64 bits in multiplication
speed is a 64 bit variable, so use 64 bits in the intermediate calculations to avoid possible overflow.
Change-Id: Id36eda6d64057cde4750184d03c9701011edb890 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1402094 --- M src/drivers/spi/cbfs_spi.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/34373/1
diff --git a/src/drivers/spi/cbfs_spi.c b/src/drivers/spi/cbfs_spi.c index ad282c6..9437c2e 100644 --- a/src/drivers/spi/cbfs_spi.c +++ b/src/drivers/spi/cbfs_spi.c @@ -55,7 +55,7 @@ u64 speed; /* KiB/s */ int bps; /* Bits per second */
- speed = size * 1000 / usecs; + speed = size * 1000ULL / usecs; bps = speed * 8;
printk(BIOS_DEBUG, "read SPI %#zx %#zx: %ld us, %lld KB/s, %d.%03d Mbps\n",