]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rbd: Silence gcc7 maybe-uninitialized warning 18504/head
authorBrad Hubbard <bhubbard@redhat.com>
Tue, 24 Oct 2017 00:55:46 +0000 (10:55 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Wed, 1 Nov 2017 03:47:55 +0000 (13:47 +1000)
gcc7 warns that GroupSnapshotNamespace::group_pool may be used
uninitialized in SnapshotNamespaceOnDisk::decode. Reordering the member
variables silences the spurious warning.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/cls/rbd/cls_rbd_types.h

index b82bf452e5195542c1873d7a72be7c53e82bedb8..d0f73f14d3352d66796fd4127859e51a6e670145 100644 (file)
@@ -252,13 +252,13 @@ struct GroupSnapshotNamespace {
 
   GroupSnapshotNamespace(int64_t _group_pool,
                         const string &_group_id,
-                        const snapid_t &_snapshot_id) :group_pool(_group_pool),
-                                                       group_id(_group_id),
-                                                       snapshot_id(_snapshot_id) {}
+                         snapid_t _snapshot_id)
+    : group_id(_group_id), group_pool(_group_pool), snapshot_id(_snapshot_id) {
+  }
 
+  std::string group_id;
   int64_t group_pool = 0;
-  string group_id;
-  snapid_t snapshot_id;
+  snapid_t snapshot_id = CEPH_NOSNAP;
 
   void encode(bufferlist& bl) const;
   void decode(bufferlist::iterator& it);