]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDCache.cc: fix dereference after null check
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 31 May 2013 16:56:21 +0000 (18:56 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 31 May 2013 17:15:22 +0000 (19:15 +0200)
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.

CID 716992 (#1 of 1): Dereference null return value (NULL_RETURNS)
  dereference: Dereferencing a pointer that might be null "dir"
  when calling "MDSCacheObject::is_auth() const".

Add assert for 'dir' before use it.

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

index 0c279b66a91ce9b08f8dd6e7c1d8228bddc7420d..f2114565573c3d7090bc798d6a84c0733158b570 100644 (file)
@@ -6625,9 +6625,10 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
        } else {
          // which dirfrag for this dentry?
          CDir *dir = diri->get_dirfrag(diri->pick_dirfrag(p->first.first));
+         assert(dir); 
          assert(dir->is_auth());
          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;