From: amitkuma Date: Mon, 7 Aug 2017 17:46:08 +0000 (+0530) Subject: librbd: Initializing member variables X-Git-Tag: v13.0.0~214^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e887e729d6f35159ff200c02faee4eecf458919;p=ceph.git librbd: Initializing member variables Fixes the coverity issues: ** 1351727 Uninitialized scalar field CID 1351727 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member m_state is not initialized in this constructor nor in any functions that it calls. ** 1351728 Uninitialized scalar field CID 1351728 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member m_state is not initialized in this constructor nor in any functions that it calls. ** 1351733 Uninitialized scalar field CID 1351733 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member snap_id is not initialized in this constructor nor in any functions that it calls. Signed-off-by: Amit Kumar amitkuma@redhat.com --- diff --git a/src/librbd/WatchNotifyTypes.h b/src/librbd/WatchNotifyTypes.h index 74cf9799e8f5..7c3255f07d5a 100644 --- a/src/librbd/WatchNotifyTypes.h +++ b/src/librbd/WatchNotifyTypes.h @@ -228,7 +228,7 @@ struct SnapRenamePayload : public SnapPayloadBase { const std::string &dst_name) : SnapPayloadBase(cls::rbd::UserSnapshotNamespace(), dst_name), snap_id(src_snap_id) {} - uint64_t snap_id; + uint64_t snap_id = 0; void encode(bufferlist &bl) const; void decode(__u8 version, bufferlist::iterator &iter); diff --git a/src/librbd/operation/FlattenRequest.h b/src/librbd/operation/FlattenRequest.h index 19637ba2e0a5..1035a141e299 100644 --- a/src/librbd/operation/FlattenRequest.h +++ b/src/librbd/operation/FlattenRequest.h @@ -73,7 +73,7 @@ private: uint64_t m_overlap_objects; ::SnapContext m_snapc; ProgressContext &m_prog_ctx; - State m_state; + State m_state = STATE_FLATTEN_OBJECTS; ParentSpec m_parent_spec; bool m_ignore_enoent; diff --git a/src/librbd/operation/RebuildObjectMapRequest.h b/src/librbd/operation/RebuildObjectMapRequest.h index 1e43f3f4c058..c7f1aa3b794d 100644 --- a/src/librbd/operation/RebuildObjectMapRequest.h +++ b/src/librbd/operation/RebuildObjectMapRequest.h @@ -63,7 +63,7 @@ private: ImageCtxT &m_image_ctx; ProgressContext &m_prog_ctx; - State m_state; + State m_state = STATE_RESIZE_OBJECT_MAP; bool m_attempted_trim; void send_resize_object_map();