]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Migrator.cc: fix possible NULL pointer dereference
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 22 May 2013 15:06:40 +0000 (17:06 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 22 May 2013 15:06:40 +0000 (17:06 +0200)
Move dout() calls behind the related asserts to prevent possible NULL
pointer dereference.

CID 717001 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "diri" when calling
  "operator <<(std::ostream &, CInode

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mds/Migrator.cc

index 565d45ddc979d4afec0218573410cd314da45835..f0deb7f882505b68cceeff4546f37f81e9ffa21a 100644 (file)
@@ -378,20 +378,20 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
 
       case IMPORT_DISCOVERED:
-       dout(10) << "import state=discovered : unpinning inode " << *diri << dendl;
        assert(diri);
+       dout(10) << "import state=discovered : unpinning inode " << *diri << dendl;
        import_reverse_discovered(df, diri);
        break;
 
       case IMPORT_PREPPING:
-       dout(10) << "import state=prepping : unpinning base+bounds " << *dir << dendl;
        assert(dir);
+       dout(10) << "import state=prepping : unpinning base+bounds " << *dir << dendl;
        import_reverse_prepping(dir);
        break;
 
       case IMPORT_PREPPED:
-       dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << dendl;
        assert(dir);
+       dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << dendl;
        {
          set<CDir*> bounds;
          cache->get_subtree_bounds(dir, bounds);