From ec43eb209fa1818d07a6cb567d3c8b82088598a4 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 21 Apr 2016 10:57:23 +0800 Subject: [PATCH] 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 --- src/crush/CrushWrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 1f9c8789d90..411b2b53364 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]; } -- 2.47.3