[coreboot-gerrit] Change in coreboot[master]: Coverity: Fix CID1393970
Patrick Rudolph (Code Review)
gerrit at coreboot.org
Thu Jul 12 16:01:39 CEST 2018
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/27453
Change subject: Coverity: Fix CID1393970
......................................................................
Coverity: Fix CID1393970
Fix possible DIVIDE_BY_ZERO.
Change-Id: I5db6866b8e51eaea201a4c03e59d7d00f4f826e7
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
---
M src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/53/27453/1
diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c
index eb2a85f..83ce563 100644
--- a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c
+++ b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c
@@ -369,7 +369,9 @@
uint64_t fr_div;
if (divider < 5) fr_div = divider * 2;
else fr_div = 8 * (divider - 3);
- uint64_t freq = (typeof(freq)) (sclk_rate / fr_div);
+ uint64_t freq = 0;
+ if (fr_div > 0)
+ freq = (typeof(freq)) (sclk_rate / fr_div);
const char *token;
if (freq < 62500000ULL) token = "???Low";
else if (freq < 90000000ULL) token = "USB2";
--
To view, visit https://review.coreboot.org/27453
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5db6866b8e51eaea201a4c03e59d7d00f4f826e7
Gerrit-Change-Number: 27453
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180712/997cdf36/attachment-0001.html>
More information about the coreboot-gerrit
mailing list