summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2022-02-28 11:47:06 -0800
committerCommit Bot <commit-bot@chromium.org>2022-02-28 20:27:52 +0000
commit8d39e763aca72c79049009865fe164f59b6c6035 (patch)
tree89e25f3d9d509134c56925218400e73b2e911dc9
parentaa7815dcfe09549c2b680e7ed604040b932c11e6 (diff)
downloadchrome-ec-8d39e763aca72c79049009865fe164f59b6c6035.tar.gz
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 <manojgupta@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3495869 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
-rw-r--r--fuzz/host_command_fuzz.c7
1 files 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.