]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Clean issues detected by cppcheck 13199/head
authorIlya Shipitsin <chipitsine@gmail.com>
Tue, 31 Jan 2017 12:07:39 +0000 (17:07 +0500)
committerIlya Shipitsin <chipitsine@gmail.com>
Tue, 31 Jan 2017 12:07:39 +0000 (17:07 +0500)
[src/mds/MDLog.cc:1172] -> [src/mds/MDLog.cc:1173]: (warning) Either the condition 'sle!=NULL' is redundant or there is possible null pointer dereference: sle.
[src/mon/MDSMonitor.cc:2622] -> [src/mon/MDSMonitor.cc:2625]: (warning) Either the condition 'mds_map!=nullptr' is redundant or there is possible null pointer dereference: mds_map.

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
src/mds/MDLog.cc
src/mon/MDSMonitor.cc

index 4bc77b58ed852e0b28db18d1f7efb28d14640da3..e3d5ab724ef5364a17de4046fd10ec2e655441fb 100644 (file)
@@ -1168,9 +1168,9 @@ void MDLog::_reformat_journal(JournalPointer const &jp_in, Journaler *old_journa
       if (le->get_type() == EVENT_SUBTREEMAP
           || le->get_type() == EVENT_SUBTREEMAP_TEST) {
         ESubtreeMap *sle = dynamic_cast<ESubtreeMap*>(le);
+        assert(sle != NULL);
         dout(20) << __func__ << " zeroing expire_pos in subtreemap event at "
           << le_pos << " seq=" << sle->event_seq << dendl;
-        assert(sle != NULL);
         sle->expire_pos = 0;
         modified = true;
       }
index c26e1ce8c166a4f504b178dde672f164bd95c8f0..1fcc585468782fc2838a882d059de7c0d12495ce 100644 (file)
@@ -2618,11 +2618,11 @@ void MDSMonitor::check_sub(Subscription *sub)
       mds_map = &(fsmap.filesystems.at(fscid)->mds_map);
     }
 
+    assert(mds_map != nullptr);
     dout(10) << __func__ << " selected MDS map epoch " <<
       mds_map->epoch << " for namespace " << fscid << " for subscriber "
       << sub->session->inst.name << " who wants epoch " << sub->next << dendl;
 
-    assert(mds_map != nullptr);
     if (sub->next > mds_map->epoch) {
       return;
     }