libceph: initialize CRUSH choose argument weights

Initialize the CRUSH choose argument weight-set array before decoding so
entries start in a defined state while the decoder fills them.

Cc: stable@vger.kernel.org
Fixes: 5cf9c4a995 ("libceph, crush: per-pool crush_choose_arg_map for crush_do_rule()")
Reported-by: Vega <vega@nebusec.ai>
Assisted-by: LLM
Signed-off-by: Darong Lu <zzyy19904204639@163.com>
Signed-off-by: Ren Wei <weir@nebusec.ai>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Darong Lu 2026-09-28 01:44:22 +08:00 committed by Ilya Dryomov
parent 569a9bb1e5
commit c3a995ff07

View File

@ -319,7 +319,7 @@ static int decode_choose_arg(void **p, void *end, struct crush_choose_arg *arg)
if (arg->weight_set_size) {
u32 i;
arg->weight_set = kmalloc_objs(*arg->weight_set,
arg->weight_set = kzalloc_objs(*arg->weight_set,
arg->weight_set_size, GFP_NOIO);
if (!arg->weight_set)
return -ENOMEM;