[Skiboot] [PATCH 2/2] external/gard: Fix uninitialised variable warning
Jeremy Kerr
jk at ozlabs.org
Mon Aug 17 16:55:08 AEST 2015
gcc -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -m64 -Werror -Wall -g2 -ggdb -D_FORTIFY_SOURCE=2 -I. -I../../ -c gard.c -o gard.o
gard.c: In function ‘main’:
gard.c:741:5: error: ‘i’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (i == ARRAY_SIZE(actions)) {
^
cc1: all warnings being treated as errors
If we 'goto out;', we'll perform the check on 'i' without having
initialised it.
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
external/gard/gard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/external/gard/gard.c b/external/gard/gard.c
index c4e8676..d84e098 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -620,7 +620,7 @@ int main(int argc, char **argv)
const char *fdt_flash_path = FDT_ACTIVE_FLASH_PATH;
char *filename = NULL;
struct gard_ctx _ctx, *ctx;
- int i, rc;
+ int rc, i = 0;
bool part = 0;
bool ecc = 0;
More information about the Skiboot
mailing list