From: Sage Weil Date: Sat, 29 Sep 2012 08:27:33 +0000 (-0700) Subject: mds: simplify get_dirfrag() X-Git-Tag: v0.54~161 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7594e9ce0f1dadfa4631e29fb4924027484e3f87;p=ceph.git mds: simplify get_dirfrag() Avoid useless have_inode() call. CID 716996: Dereference null return value (NULL_RETURNS) At (13): Dereferencing a pointer that might be null "this->get_inode(df.ino, snapid_t(18446744073709551614UL))" when calling "CInode::get_dirfrag(frag_t)". [hide details] Signed-off-by: Sage Weil --- diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 12bdb0300a80..64290aa97b98 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -556,8 +556,10 @@ public: } CDir* get_dirfrag(dirfrag_t df) { - if (!have_inode(df.ino)) return NULL; - return get_inode(df.ino)->get_dirfrag(df.frag); + CInode *in = get_inode(df.ino); + if (!in) + return NULL; + return in->get_dirfrag(df.frag); } CDir* get_force_dirfrag(dirfrag_t df) { CInode *diri = get_inode(df.ino);