From 8d39e763aca72c79049009865fe164f59b6c6035 Mon Sep 17 00:00:00 2001 From: Manoj Gupta Date: Mon, 28 Feb 2022 11:47:06 -0800 Subject: fuzz: Stop mixing decl + initialization Initialization with dec is supported only in C99 mode which EC code is apparently not. Fixes error with newer clang: 'mixing declarations and code is incompatible with standards before C99' BUG=b:221860687 TEST=emerge chromeos-ec Change-Id: I74c3e3aaf071ac86ad9e7b1276043efe32f1ff1b Signed-off-by: Manoj Gupta Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3495869 Reviewed-by: Mary Ruthven Commit-Queue: Manoj Gupta Tested-by: Manoj Gupta Auto-Submit: Manoj Gupta --- fuzz/host_command_fuzz.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fuzz/host_command_fuzz.c b/fuzz/host_command_fuzz.c index 5d490bc192..381e7686c3 100644 --- a/fuzz/host_command_fuzz.c +++ b/fuzz/host_command_fuzz.c @@ -56,6 +56,9 @@ struct chunk { static int hostcmd_fill(const uint8_t *data, size_t size) { static int first = 1; + int ipos = 0; + int i; + int req_size = 0; #ifdef VALID_REQUEST_ONLY const int checksum_offset = offsetof(struct ec_host_request, checksum); @@ -75,10 +78,6 @@ static int hostcmd_fill(const uint8_t *data, size_t size) struct chunk chunks[1] = { {0, sizeof(req_buf)} }; #endif - int ipos = 0; - int i; - int req_size = 0; - /* * TODO(chromium:854975): We should probably malloc req_buf with the * correct size, to make we do not read uninitialized req_buf data. -- cgit v1.2.1