]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
libceph: Fix unnecessarily high ceph_decode_need() for uniform bucket
authorRaphael Zimmer <raphael.zimmer@tu-ilmenau.de>
Fri, 24 Apr 2026 13:37:37 +0000 (15:37 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 29 Apr 2026 00:13:03 +0000 (02:13 +0200)
commit0dc1fc203709736c331c72aea63e1e16f171017b
tree67b5c787b34d80d0cd5971124b8f4e275a456ba6
parentc9800a0650431b92803a537b0737a67df6d23d4b
libceph: Fix unnecessarily high ceph_decode_need() for uniform bucket

In crush_decode_uniform_bucket(), the item_weight field of the bucket
is set. This is a single field of type u32 since the uniform bucket uses
the same weight for all items. The value in ceph_decode_need() is set to
(1+b->h.size) * sizeof(u32), which is higher than actually needed.

This patch removes the call to ceph_decode_need() with the unnecessarily
high value and switches the subsequent operation from ceph_decode_32()
to ceph_decode_32_safe(), which already includes the correct bounds
check.

Signed-off-by: Raphael Zimmer <raphael.zimmer@tu-ilmenau.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/osdmap.c