From 9d44676b1566820f70371e1b50e1dca9a19a8e9f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 5 Jun 2008 13:26:13 -0700 Subject: [PATCH] crush: add a few assertions to catch badness early --- src/crush/mapper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crush/mapper.c b/src/crush/mapper.c index 665b1371acc57..e3b0cbf1b01f8 100644 --- a/src/crush/mapper.c +++ b/src/crush/mapper.c @@ -222,6 +222,7 @@ static int crush_choose(struct crush_map *map, BUG_ON(1); item = in->items[0]; } + BUG_ON(item >= map->max_devices); /* desired type? */ if (item < 0) @@ -294,6 +295,7 @@ int crush_do_rule(struct crush_map *map, int i,j; int numrep; + BUG_ON(ruleno >= map->max_rules); rule = map->rules[ruleno]; result_len = 0; w = a; -- 2.39.5