From: Danny Al-Gaaf Date: Sat, 1 Mar 2014 12:11:48 +0000 (+0100) Subject: MDCache: fix potential null pointer deref X-Git-Tag: v0.78~108^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1747c589e7731dea1068d1d020dc2774eb92ae46;p=ceph.git MDCache: fix potential null pointer deref 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 --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 14416c62986c..080fe1bd05e3 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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)) {