mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
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> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67864 Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
parent
399a4dd721
commit
355a1df183
@ -491,10 +491,11 @@ int stlinkv3_spi_init(void)
|
||||
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");
|
||||
return -1;
|
||||
}
|
||||
free(speed_str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user