From 7824d9bf699e245ff5c21262ff51acaeac0186af Mon Sep 17 00:00:00 2001 From: Zhuohao Lee Date: Fri, 30 Mar 2018 10:18:04 +0800 Subject: chromeec: fix an uninitialized local variable google_chromeec_command() may only write the 1 or 2 bytes to variable r (4 bytes). However, this api returns 4 bytes data. To avaid returning the incorrect data, we need to initialize the local variable. BUG=b:76442548 BRANCH=none TEST=write 2 bytes data into the flash, then, read by cbi_get_uint32 Change-Id: I3395c97ab6bfd7882d7728310de8a29041190e76 Signed-off-by: Zhuohao Lee Reviewed-on: https://review.coreboot.org/25460 Reviewed-by: Aaron Durbin Reviewed-by: Daisuke Nojiri Tested-by: build bot (Jenkins) --- src/ec/google/chromeec/ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ec') diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index efe22e2ab9..fb3ffab181 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -563,7 +563,7 @@ static int cbi_get_uint32(uint32_t *id, uint32_t type) { struct chromeec_command cmd; struct ec_params_get_cbi p; - uint32_t r; + uint32_t r = 0; int rv; p.type = type; -- cgit v1.2.3