Commit c7ed1a4b authored by Ilya Dryomov's avatar Ilya Dryomov

crush: assume weight_set != null imples weight_set_size > 0

Reflects ceph.git commit 5e8fa3e06b68fae1582c9230a3a8d1abc6146286.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarSage Weil <sage@redhat.com>
parent e17e8969
...@@ -306,7 +306,7 @@ static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket, ...@@ -306,7 +306,7 @@ static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket,
const struct crush_choose_arg *arg, const struct crush_choose_arg *arg,
int position) int position)
{ {
if (!arg || !arg->weight_set || arg->weight_set_size == 0) if (!arg || !arg->weight_set)
return bucket->item_weights; return bucket->item_weights;
if (position >= arg->weight_set_size) if (position >= arg->weight_set_size)
......
...@@ -295,6 +295,10 @@ static int decode_choose_args(void **p, void *end, struct crush_map *c) ...@@ -295,6 +295,10 @@ static int decode_choose_args(void **p, void *end, struct crush_map *c)
ret = decode_choose_arg(p, end, arg); ret = decode_choose_arg(p, end, arg);
if (ret) if (ret)
goto fail; goto fail;
if (arg->ids_size &&
arg->ids_size != c->buckets[bucket_index]->size)
goto e_inval;
} }
insert_choose_arg_map(&c->choose_args, arg_map); insert_choose_arg_map(&c->choose_args, arg_map);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment