]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: add a few assertions to catch badness early
authorSage Weil <sage@newdream.net>
Thu, 5 Jun 2008 20:26:13 +0000 (13:26 -0700)
committerSage Weil <sage@newdream.net>
Thu, 5 Jun 2008 20:26:13 +0000 (13:26 -0700)
src/crush/mapper.c

index 665b1371acc574bc309cd2819e47a4467073e8a0..e3b0cbf1b01f8104371f7fab0d4f272dbf900ca9 100644 (file)
@@ -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;