Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid div-by-zero ......................................................................
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");
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid div-by-zero ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/flashrom/+/40653/1/stlinkv3_spi.c File stlinkv3_spi.c:
https://review.coreboot.org/c/flashrom/+/40653/1/stlinkv3_spi.c@497 PS1, Line 497: simple non-zero
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/40653
to look at the new patch set (#2).
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
stlinkv3_spi: Avoid division 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, 3 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/53/40653/2
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/flashrom/+/40653/1/stlinkv3_spi.c File stlinkv3_spi.c:
https://review.coreboot.org/c/flashrom/+/40653/1/stlinkv3_spi.c@497 PS1, Line 497: simple
non-zero
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
Patch Set 2: Code-Review+2
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
Patch Set 2: Code-Review+2
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
Patch Set 2: Code-Review+2
Angel Pons has submitted this change. ( https://review.coreboot.org/c/flashrom/+/40653 )
Change subject: stlinkv3_spi: Avoid division by zero ......................................................................
stlinkv3_spi: Avoid division by zero
Change-Id: I08c0612f3fea59add9bde2fb3cc5c4b5c3756516 Found-by: Coverity Scan #1412744 Signed-off-by: Patrick Georgi pgeorgi@google.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/40653 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Stefan Reinauer stefan.reinauer@coreboot.org Reviewed-by: Edward O'Callaghan quasisec@chromium.org --- M stlinkv3_spi.c 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved Angel Pons: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index 9e621c2..114c0ca 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -491,10 +491,11 @@ 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"); + msg_perr("Please pass the parameter " + "with a simple non-zero number in kHz\n"); free(speed_str); return -1; }