From 655c12ac50bc60ea7ccbe84319f79182e7b4de71 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Fri, 10 Apr 2015 10:19:25 +0200 Subject: [PATCH] psim.cc: change initialzation of VLAs Use memset to fill integer VLAs. Fix for: CID 1219649 (#1 of 1): Uninitialized scalar variable (UNINIT) uninit_use: Using uninitialized value primary_count[primary] CID 1219648 (#1 of 1): Uninitialized scalar variable (UNINIT) uninit_use: Using uninitialized value first_count[osds[0UL]] CID 1219647 (#1 of 1): Uninitialized scalar variable (UNINIT) uninit_use: Using uninitialized value count[osds[i]] Signed-off-by: Danny Al-Gaaf --- src/tools/psim.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/psim.cc b/src/tools/psim.cc index 3022b1c1504..04a1987d2ec 100644 --- a/src/tools/psim.cc +++ b/src/tools/psim.cc @@ -32,22 +32,22 @@ int main(int argc, char **argv) int count[n]; int first_count[n]; int primary_count[n]; + int size[4]; + + memset(count, 0, sizeof(count)); + memset(first_count, 0, sizeof(first_count)); + memset(primary_count, 0, sizeof(primary_count)); + memset(size, 0, sizeof(size)); + for (int i=0; itype = pg_pool_t::TYPE_ERASURE; - int size[4]; - for (int i=0; i<4; i++) - size[i] = 0; - for (int n = 0; n < 10; n++) { // namespaces char nspace[20]; snprintf(nspace, sizeof(nspace), "n%d", n);