l2tp: remove unneeded null check in l2tp_v2_session_get_next
Subsystems (2)
PATCH v2 1/1 l2tp: remove unneeded null check in l2tp_v2_session_get_next
Commit aa92c1cec92b ("l2tp: add tunnel/session get_next helpers") uses idr_get_next APIs to iterate over l2tp session IDR lists. Sessions in l2tp_v2_session_idr always have a non-null session->tunnel pointer since l2tp_session_register sets it before inserting the session into the IDR. Therefore the null check on session->tunnel in l2tp_v2_session_get_next is redundant and can be removed. Removing the check avoids a warning from lkp.
---
v2: improve commit log and use acked-by tag
v1: https://lore.kernel.org/netdev/[email protected]/
--- net/l2tp/l2tp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_core.c +1 -1
@@ -345,7 +345,7 @@ static struct l2tp_session *l2tp_v2_session_get_next(const struct net *net, goto again; } -if (tunnel && tunnel->tunnel_id == tid && +if (tunnel->tunnel_id == tid &&refcount_inc_not_zero (&session->ref_count)) {rcu_read_unlock_bh ();return session;
Signature · 1 line
2.34.1
Quoted 13 lines · James Chapman
Commit
aa92c1cec92b("l2tp: add tunnel/sessionget_nexthelpers") usesidr_get_nextAPIs to iterate over l2tp session IDR lists. Sessions inl2tp_v2_session_idralways have a non-nullsession->tunnelpointer sincel2tp_session_registersets it before inserting the session into the IDR. Therefore the null check onsession->tunnelinl2tp_v2_session_get_nextis redundant and can be removed. Removing the check avoids a warning from lkp.Reported-by kernel test robot <[email protected]>CC Dan Carpenter <[email protected]>Signed-off-by James Chapman <[email protected]>Acked-by Tom Parkin <[email protected]>
Quoted 5 lines
---
v2: improve commit log and use acked-by tag
v1: https://lore.kernel.org/netdev/[email protected]/
Thanks for the update.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 3 Sep 2024 12:35:47 +0100 you wrote:
Commit
aa92c1cec92b("l2tp: add tunnel/sessionget_nexthelpers") usesidr_get_nextAPIs to iterate over l2tp session IDR lists. Sessions inl2tp_v2_session_idralways have a non-nullsession->tunnelpointer sincel2tp_session_registersets it before inserting the session into the IDR. Therefore the null check onsession->tunnelinl2tp_v2_session_get_nextis redundant and can be removed. Removing the check avoids a warning from lkp.[...]
Here is the summary with links:
- [net-next,v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next
https://git.kernel.org/netdev/net-next/c/510c0732fc8c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html