]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
include/cpp-btree: fix array bounds warning in child() accessors 66549/head
authorKefu Chai <k.chai@proxmox.com>
Mon, 8 Dec 2025 08:29:00 +0000 (16:29 +0800)
committerKefu Chai <k.chai@proxmox.com>
Mon, 8 Dec 2025 12:13:47 +0000 (20:13 +0800)
commit78d29e2a06d135ad8756d0f8e49e88a267b5fa79
tree061ffe3527609fc9c019454c3c0c79f69c0d2a1c
parenta0519047d7e2c749a4cc9deb7a5490b064a7fe4c
include/cpp-btree: fix array bounds warning in child() accessors

Replace array indexing with pointer arithmetic in child() and
mutable_child() methods to avoid compiler warning when accessing
child nodes beyond the static array bounds.

The original code was functionally correct but triggered
-Warray-bounds when accessing mutable_child(32) during btree
operations. Using pointer arithmetic achieves the same result
without the bounds check warning.

This is a follow-up to commit 8458a19ab which fixed similar
warnings in other btree_node methods.

No functional changes.

Fixes: https://tracker.ceph.com/issues/72477
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/cpp-btree/btree.h