Patrick Georgi has uploaded this change for review.

View Change

stlinkv3_spi: Avoid div-by-zero

Change-Id: I08c0612f3fea59add9bde2fb3cc5c4b5c3756516
Found-by: Coverity Scan #1412744
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
---
M stlinkv3_spi.c
1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/53/40653/1
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index 9e621c2..6297861 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -491,7 +491,7 @@
speed_str = extract_programmer_param("spispeed");
if (speed_str) {
sck_freq_kHz = strtoul(speed_str, &endptr, 0);
- if (*endptr) {
+ if (*endptr || sck_freq_kHz == 0) {
msg_perr("The spispeed parameter passed with invalid format: %s\n",
speed_str);
msg_perr("Please pass the parameter with a simple number in kHz\n");

To view, visit change 40653. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I08c0612f3fea59add9bde2fb3cc5c4b5c3756516
Gerrit-Change-Number: 40653
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi@google.com>
Gerrit-MessageType: newchange