From ac1b6a7efbbd3c2a6c68c674d9a36a39e32e4c59 Mon Sep 17 00:00:00 2001 From: amitkuma Date: Sun, 17 Sep 2017 12:35:26 +0530 Subject: [PATCH] messages,test,msg: Initializing h,reply_type,owner Fixes the coverity issues: ** 717326 Uninitialized scalar field 2. uninit_member: Non-static class member field h.fsid is not initialized in this constructor nor in any functions that it calls. 4. uninit_member: Non-static class member field h.version is not initialized in this constructor nor in any functions that it calls. CID 717326 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 6. uninit_member: Non-static class member field h.st is not initialized in this constructor nor in any functions that it calls. ** 1244199 Uninitialized scalar field CID 1244199 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member reply_type is not initialized in this constructor nor in any functions that it calls. ** 1249637 Uninitialized scalar field CID 1249637 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member owner is not initialized in this constructor nor in any functions that it calls. Signed-off-by: Amit Kumar --- src/messages/MStatfsReply.h | 2 +- src/msg/async/Event.h | 2 +- src/test/mon/test-mon-msg.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messages/MStatfsReply.h b/src/messages/MStatfsReply.h index dd9690dad6a3c..195a369e15ea7 100644 --- a/src/messages/MStatfsReply.h +++ b/src/messages/MStatfsReply.h @@ -18,7 +18,7 @@ class MStatfsReply : public Message { public: - struct ceph_mon_statfs_reply h; + struct ceph_mon_statfs_reply h{}; MStatfsReply() : Message(CEPH_MSG_STATFS_REPLY) {} MStatfsReply(uuid_d &f, ceph_tid_t t, epoch_t epoch) : Message(CEPH_MSG_STATFS_REPLY) { diff --git a/src/msg/async/Event.h b/src/msg/async/Event.h index b4743c1b278d2..1ccff4bb333e4 100644 --- a/src/msg/async/Event.h +++ b/src/msg/async/Event.h @@ -155,7 +155,7 @@ class EventCenter { std::string type; int nevent; // Used only to external event - pthread_t owner; + pthread_t owner = 0; std::mutex external_lock; std::atomic_ulong external_num_events; deque external_events; diff --git a/src/test/mon/test-mon-msg.cc b/src/test/mon/test-mon-msg.cc index 66fab30d07ac2..83c049b70e17c 100644 --- a/src/test/mon/test-mon-msg.cc +++ b/src/test/mon/test-mon-msg.cc @@ -219,7 +219,7 @@ class MonMsgTest : public MonClientHelper, public ::testing::Test { protected: - int reply_type; + int reply_type = 0; Message *reply_msg = nullptr; Mutex lock; Cond cond; -- 2.39.5