Skip to content

Commit 5f444f5

Browse files
committed
external/gard: Fix uninitialised variable warning
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 <[email protected]>
1 parent 3b8678e commit 5f444f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

external/gard/gard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ int main(int argc, char **argv)
620620
const char *fdt_flash_path = FDT_ACTIVE_FLASH_PATH;
621621
char *filename = NULL;
622622
struct gard_ctx _ctx, *ctx;
623-
int i, rc;
623+
int rc, i = 0;
624624
bool part = 0;
625625
bool ecc = 0;
626626

0 commit comments

Comments
 (0)