diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2020-12-29 11:44:35 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-30 11:46:55 +0000 |
commit | 80220c17e37c1fc67c38df61ba48fa1afd82f34c (patch) | |
tree | 7e2f05e58c33a2aad549f8b9811f3e9dae8bdfec | |
parent | 0402692306c7de3041240a5148ebee7537a49925 (diff) | |
download | chrome-ec-80220c17e37c1fc67c38df61ba48fa1afd82f34c.tar.gz |
ectool: zero out ec_response_sysinfo before usage in cmd_sysinfo
Explicitly zero out ec_response_sysinfo before usage, without that it
generates a compiler warning when building otuside of chroot, with a
modern compiler:
util/ectool.c: In function ‘cmd_sysinfo’:
util/ectool.c:1875:3: error: ‘r.current_image’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1875 | printf("%d\n", r.current_image);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
BUG=none
TEST=build only, warning is gone
BRANCH=none
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: I2f1fecf2a8cfa8c80422fac105ee35f62290e160
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606229
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
-rw-r--r-- | util/ectool.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c index a286ace289..5f1b491c85 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -1853,6 +1853,7 @@ int cmd_sysinfo(int argc, char **argv) goto sysinfo_error_usage; } + memset(&r, '\0', sizeof(r)); if (sysinfo(&r) != 0) return -1; |