From: xie xingguo Date: Thu, 21 Apr 2016 02:57:23 +0000 (+0800) Subject: crush: fix get_rule_step() can't catch all errors X-Git-Tag: v11.0.0~844^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec43eb209fa1818d07a6cb567d3c8b82088598a4;p=ceph.git crush: fix get_rule_step() can't catch all errors Because get_rule() may return -ENOENT on error, we shall use the IS_ERR macro to catch that, as all the other callers does. Signed-off-by: xie xingguo --- diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 1f9c8789d909..411b2b53364d 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -726,7 +726,7 @@ private: } crush_rule_step *get_rule_step(unsigned ruleno, unsigned step) const { crush_rule *n = get_rule(ruleno); - if (!n) return (crush_rule_step *)(-EINVAL); + if (IS_ERR(n)) return (crush_rule_step *)(-EINVAL); if (step >= n->len) return (crush_rule_step *)(-EINVAL); return &n->steps[step]; }