All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] lib/btree: fix two bugs with key 0
@ 2026-12-05 23:07 Jyun-An Chen
  2026-12-05 23:07 ` [PATCH 1/2] lib/btree: fix btree_remove() of a key 0 that is not in the tree Jyun-An Chen
  2026-12-05 23:07 ` [PATCH 2/2] lib/btree: stop btree_get_prev() from wrapping around below key 0 Jyun-An Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Jyun-An Chen @ 2026-12-05 23:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Jyun-An Chen

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-05 23:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 23:07 [PATCH 0/2] lib/btree: fix two bugs with key 0 Jyun-An Chen
2026-12-05 23:07 ` [PATCH 1/2] lib/btree: fix btree_remove() of a key 0 that is not in the tree Jyun-An Chen
2026-12-05 23:07 ` [PATCH 2/2] lib/btree: stop btree_get_prev() from wrapping around below key 0 Jyun-An Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.