From: Danny Al-Gaaf Date: Fri, 10 Apr 2015 08:19:25 +0000 (+0200) Subject: psim.cc: change initialzation of VLAs X-Git-Tag: v9.0.1~128^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=655c12ac50bc60ea7ccbe84319f79182e7b4de71;p=ceph.git 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 --- diff --git a/src/tools/psim.cc b/src/tools/psim.cc index 3022b1c15042..04a1987d2ec3 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);