diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2018-04-11 09:09:46 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-04-12 07:59:48 -0700 |
commit | ce02b596560ac8986fe1ca3d6570a88914cc870f (patch) | |
tree | 430095fbb156cfa27f3ccaefc18b0b9c2596bc56 | |
parent | 5b521e3ac66fcd576db0fdf0de78b5d5d67768ed (diff) | |
download | chrome-ec-ce02b596560ac8986fe1ca3d6570a88914cc870f.tar.gz |
stm32mon: terminate gracefully when failing to get commands list
When the CMD_GETCMD transaction fails, terminate immediately rather than
continuing and crashing when we use later the uninitialized 'erase'
function.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:77825616
TEST=flash Scarlet EC through CCD.
Change-Id: Ia40107fe27d81fdb9ee8220f73f4215d936a41c1
Reviewed-on: https://chromium-review.googlesource.com/1006595
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r-- | util/stm32mon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/stm32mon.c b/util/stm32mon.c index f5fe227fc6..860bcc8c56 100644 --- a/util/stm32mon.c +++ b/util/stm32mon.c @@ -525,6 +525,7 @@ int command_get_commands(int fd, struct stm32_def *chip) return 0; } + fprintf(stderr, "Cannot get bootloader command list.\n"); return -1; } @@ -1060,7 +1061,8 @@ int main(int argc, char **argv) if (!chip) goto terminate; - command_get_commands(ser, chip); + if (command_get_commands(ser, chip) < 0) + goto terminate; if (flags & FLAG_READ_UNPROTECT) command_read_unprotect(ser); |