diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2017-07-24 09:49:52 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-08-01 10:46:44 -0400 |
commit | c7ed1a4bf4b446317eefa0f4916d94b1f6d3ada5 (patch) | |
tree | 7ec262c80b210ea5deefcc682c5c5dec03f7650a | |
parent | e17e8969f5c59a10083af5e260bdad6026872203 (diff) |
crush: assume weight_set != null imples weight_set_size > 0
Reflects ceph.git commit 5e8fa3e06b68fae1582c9230a3a8d1abc6146286.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
-rw-r--r-- | net/ceph/crush/mapper.c | 2 | ||||
-rw-r--r-- | net/ceph/osdmap.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 746b145bfd11..417df675c71b 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c | |||
@@ -306,7 +306,7 @@ static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket, | |||
306 | const struct crush_choose_arg *arg, | 306 | const struct crush_choose_arg *arg, |
307 | int position) | 307 | int position) |
308 | { | 308 | { |
309 | if (!arg || !arg->weight_set || arg->weight_set_size == 0) | 309 | if (!arg || !arg->weight_set) |
310 | return bucket->item_weights; | 310 | return bucket->item_weights; |
311 | 311 | ||
312 | if (position >= arg->weight_set_size) | 312 | if (position >= arg->weight_set_size) |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index eb57a06373ca..2586e5546143 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -295,6 +295,10 @@ static int decode_choose_args(void **p, void *end, struct crush_map *c) | |||
295 | ret = decode_choose_arg(p, end, arg); | 295 | ret = decode_choose_arg(p, end, arg); |
296 | if (ret) | 296 | if (ret) |
297 | goto fail; | 297 | goto fail; |
298 | |||
299 | if (arg->ids_size && | ||
300 | arg->ids_size != c->buckets[bucket_index]->size) | ||
301 | goto e_inval; | ||
298 | } | 302 | } |
299 | 303 | ||
300 | insert_choose_arg_map(&c->choose_args, arg_map); | 304 | insert_choose_arg_map(&c->choose_args, arg_map); |