From: Wei Yang Date: Wed, 13 Nov 2024 03:16:16 +0000 (+0000) Subject: maple_tree: only root node could be deficient X-Git-Tag: v6.14-rc1~77^2~272 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7318f95ba40bed454d1e20f27e821198d3def4e5;p=thirdparty%2Flinux.git maple_tree: only root node could be deficient Each level's rightmost node should have (max == ULONG_MAX). This means current validation skips the right most node on each level. Only the root node may be below the minimum data threshold. Link: https://lkml.kernel.org/r/20241113031616.10530-4-richard.weiyang@gmail.com Signed-off-by: Wei Yang Reviewed-by: Liam R. Howlett Cc: Sidhartha Kumar Cc: Lorenzo Stoakes Signed-off-by: Andrew Morton --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ca8ae1e1cc0a5..f7153ade1be5f 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7556,7 +7556,7 @@ void mt_validate(struct maple_tree *mt) MAS_WARN_ON(&mas, mte_dead_node(mas.node)); end = mas_data_end(&mas); if (MAS_WARN_ON(&mas, (end < mt_min_slot_count(mas.node)) && - (mas.max != ULONG_MAX))) { + (!mte_is_root(mas.node)))) { pr_err("Invalid size %u of " PTR_FMT "\n", end, mas_mn(&mas)); }