]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MDCache: fix potential null pointer deref
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 12:11:48 +0000 (13:11 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 12:11:48 +0000 (13:11 +0100)
CID 716921 (#1 of 1): Dereference after null check (FORWARD_NULL)
 var_deref_model: Passing null pointer "dir" to function
 "operator <<(std::ostream &, CDir &)", which dereferences it.

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

index 14416c62986c9c4afce92bf6a2d010331b8555a7..080fe1bd05e32f12a93139fd93cd29cb7d7da2e6 100644 (file)
@@ -6973,8 +6973,12 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
          dn = dir->lookup(p->first.first, p->first.second);
        }
 
-       if (!dn) 
-         dout(0) << "  missing dentry for " << p->first.first << " snap " << p->first.second << " in " << *dir << dendl;
+       if (!dn) { 
+         if (dir)
+           dout(0) << "  missing dentry for " << p->first.first << " snap " << p->first.second << " in " << *dir << dendl;
+         else
+           dout(0) << "  missing dentry for " << p->first.first << " snap " << p->first.second << dendl;
+       }
        assert(dn);
        
        if (nonce == dn->get_replica_nonce(from)) {