maple_tree: Remove a BUG_ON() in mas_alloc_nodes()
Subsystems (3)
PATCH 1/1 maple_tree: Remove a BUG_ON() in mas_alloc_nodes()
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().
--- lib/maple_tree.c | 1 - 1 file changed, 1 deletion(-)
lib/maple_tree.c +0 -1
@@ -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); }
Signature · 1 line
2.48.1
Quoted 5 lines · Petr Tesarik
Remove a
BUG_ON()right before aWARN_ON()with the same condition.Calling
WARN_ON()andBUG_ON()here is definitely wrong. Since the goal is generally to removeBUG_ON()invocations from the kernel, keep only theWARN_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.
Quoted 3 lines
Fixes 067311d33e65 ("maple_tree: separate ma_state node from status")Signed-off-by Petr Tesarik <[email protected]>
Quoted 19 lines
--- lib/maple_tree.c | 1 - 1 file changed, 1 deletion(-)lib/maple_tree.c +0
-1@@ -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); }Signature · 1 line
2.48.1