summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-31 18:56:21 +0200
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>2013-05-31 19:15:22 +0200
commit5d8440e3713dbb0e8515a4a8527f97d7b84859a0 (patch)
treeff4734eeaf4c6da4d5597314cdc0735d42bbbdeb
parent59cffbabcffa2c55acf43eb604d42c7a24d405c3 (diff)
downloadceph-5d8440e3713dbb0e8515a4a8527f97d7b84859a0.tar.gz
mds/MDCache.cc: fix dereference after null check
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>
-rw-r--r--src/mds/MDCache.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 0c279b66a91..f2114565573 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -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;