* [PATCH] maple_tree: Remove a BUG_ON() in mas_alloc_nodes()
@ 2025-02-13 11:44 Petr Tesarik
2025-02-13 19:37 ` Liam R. Howlett
0 siblings, 1 reply; 2+ messages in thread
From: Petr Tesarik @ 2025-02-13 11:44 UTC (permalink / raw)
To: Liam R. Howlett, Andrew Morton, open list:MAPLE TREE
Cc: open list:MAPLE TREE, open list:LIBRARY CODE, Petr Tesarik
Remove a BUG_ON() right before a WARN_ON() with the same condition.
Calling WARN_ON() and BUG_ON() here is definitely wrong. Since the goal is
generally to remove BUG_ON() invocations from the kernel, keep only the
WARN_ON().
Fixes: 067311d33e65 ("maple_tree: separate ma_state node from status")
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
lib/maple_tree.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index f7153ade1be5..0f2111d436c4 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -1245,7 +1245,6 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp)
if (mas->mas_flags & MA_STATE_PREALLOC) {
if (allocated)
return;
- BUG_ON(!allocated);
WARN_ON(!allocated);
}
--
2.48.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] maple_tree: Remove a BUG_ON() in mas_alloc_nodes()
2025-02-13 11:44 [PATCH] maple_tree: Remove a BUG_ON() in mas_alloc_nodes() Petr Tesarik
@ 2025-02-13 19:37 ` Liam R. Howlett
0 siblings, 0 replies; 2+ messages in thread
From: Liam R. Howlett @ 2025-02-13 19:37 UTC (permalink / raw)
To: Petr Tesarik
Cc: Andrew Morton, open list:MAPLE TREE, open list:MAPLE TREE,
open list:LIBRARY CODE
* Petr Tesarik <ptesarik@suse.com> [250213 06:45]:
> Remove a BUG_ON() right before a WARN_ON() with the same condition.
>
> Calling WARN_ON() and BUG_ON() here is definitely wrong. Since the goal is
> generally to remove BUG_ON() invocations from the kernel, keep only the
> WARN_ON().
Sure.. but this isn't going to have the end result of not crashing. We
ran out of allocations so we will very quickly be dereferencing NULL.
Care has been taken to avoid this from happening, so I'm fine with
either as this comes up in testing only. In fact, I probably added this
during the testing and it slipped through. Thanks for finding it.
>
> Fixes: 067311d33e65 ("maple_tree: separate ma_state node from status")
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
> lib/maple_tree.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index f7153ade1be5..0f2111d436c4 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1245,7 +1245,6 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp)
> if (mas->mas_flags & MA_STATE_PREALLOC) {
> if (allocated)
> return;
> - BUG_ON(!allocated);
> WARN_ON(!allocated);
> }
>
> --
> 2.48.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-13 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-13 11:44 [PATCH] maple_tree: Remove a BUG_ON() in mas_alloc_nodes() Petr Tesarik
2025-02-13 19:37 ` Liam R. Howlett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox