[PATCH 0/2] lib/btree: fix two bugs with key 0
From: Jyun-An Chen
Date: Sat Dec 05 2026 - 18:07:37 EST
Unused slots in a lib/btree node hold key 0, and inner node keys can
be lowered to 0, so key 0 is not handled correctly in two places.
Patch 1 fixes btree_remove() of a key 0 that is not in the tree, which
drops another entry from the tree and can write in front of the node.
Patch 2 fixes btree_get_prev() wrapping around below key 0, which makes
a btree_for_each_safe*() loop never terminate.
The only in-tree user of lib/btree is qla2xxx, and I could not find a
path there that hits either bug, so this is not known to fix a problem
that users see today. Key 0 is a valid key, though, and these fixes
keep a future user of the library from running into them.
Jyun-An Chen (2):
lib/btree: fix btree_remove() of a key 0 that is not in the tree
lib/btree: stop btree_get_prev() from wrapping around below key 0
lib/btree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4