summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-12-19 11:22:30 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-12-25 15:21:15 +0000
commit9b4b7c57af7a3564120ae64296a194c6f5285658 (patch)
tree81c5d4026f87f4f52a908bdbf407765304fd2a87
parent20d4d229c9096a07ce97dde79c364c6218077ebf (diff)
downloadchrome-ec-9b4b7c57af7a3564120ae64296a194c6f5285658.tar.gz
usb_updater: initialize corrupt_inactive_rw before using it
The earlier change introduced the uninitialized variable bug, which was not caught by the compiler. Let's make sure the variable is always initialized, and also let's add a message informing the user that the binary image is ignored when -f or -c command line options are given. BRANCH=none BUG=chrome-os-partner:55667 TEST=there is no accidental attempts to erase the inactive firmware any more. The message is printed when the binary image is ignored. Change-Id: If67841fa3933e7c2df772348ed5308ff722a6e3a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/421498 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/422759 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Trybot-Ready: Hung-Te Lin <hungte@chromium.org>
-rw-r--r--extra/usb_updater/usb_updater.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index 04e5b615f0..e41c3027b1 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -1198,7 +1198,7 @@ int main(int argc, char *argv[])
int transferred_sections = 0;
int binary_vers = 0;
int show_fw_ver = 0;
- int corrupt_inactive_rw;
+ int corrupt_inactive_rw = 0;
progname = strrchr(argv[0], '/');
if (progname)
@@ -1281,6 +1281,9 @@ int main(int argc, char *argv[])
if (binary_vers)
exit(show_headers_versions(data));
+ } else {
+ if (optind < argc)
+ printf("Ignoring binary image %s\n", argv[optind]);
}
if (td.ep_type == usb_xfer) {