]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crush: fix get_rule_step() can't catch all errors
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 21 Apr 2016 02:57:23 +0000 (10:57 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 21 Apr 2016 07:49:07 +0000 (15:49 +0800)
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 <xie.xingguo@zte.com.cn>
src/crush/CrushWrapper.h

index 1f9c8789d90990f3dd2b47184655d5b1ac494823..411b2b53364d107b128688f5bbb2deac37fe0d5f 100644 (file)
@@ -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];
   }