From dfe152f3a11d061ac533b00d70bc8c4d746b1ec3 Mon Sep 17 00:00:00 2001 From: amitkuma Date: Tue, 19 Sep 2017 19:32:02 +0530 Subject: [PATCH] osd,messages: Initialize read_length,options,send_reply Fixes the coverity issues: ** 1415776 Uninitialized scalar field CID 1415776 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member field read_length.v is not initialized in this constructor nor in any functions that it calls. ** 1415811 Uninitialized scalar field CID 1415811 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member options is not initialized in this constructor nor in any functions that it calls. ** 1415850 Uninitialized scalar field CID 1415850 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member sent_reply is not initialized in this constructor nor in any functions that it calls. Signed-off-by: Amit Kumar --- src/messages/MOSDForceRecovery.h | 2 +- src/osd/PrimaryLogPG.cc | 2 +- src/osd/PrimaryLogPG.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messages/MOSDForceRecovery.h b/src/messages/MOSDForceRecovery.h index d06af07460d..44c221f56ea 100644 --- a/src/messages/MOSDForceRecovery.h +++ b/src/messages/MOSDForceRecovery.h @@ -38,7 +38,7 @@ struct MOSDForceRecovery : public Message { uuid_d fsid; vector forced_pgs; - uint8_t options; + uint8_t options = 0; MOSDForceRecovery() : Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {} MOSDForceRecovery(const uuid_d& f, char opts) : diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 76ea8ac4007..3bc2bbd9885 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4604,7 +4604,7 @@ int PrimaryLogPG::finish_checksum(OSDOp& osd_op, struct C_ExtentCmpRead : public Context { PrimaryLogPG *primary_log_pg; OSDOp &osd_op; - ceph_le64 read_length; + ceph_le64 read_length{}; bufferlist read_bl; Context *fill_extent_ctx; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 18cfb49a410..177ec6f4173 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -573,7 +573,7 @@ public: on_committed.emplace_back(std::forward(f)); } - bool sent_reply; + bool sent_reply = false; // pending async reads -> list, -- 2.39.5