* [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next
@ 2024-09-03 11:35 James Chapman
2024-09-03 16:35 ` Simon Horman
2024-09-04 23:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: James Chapman @ 2024-09-03 11:35 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, dsahern, kernel test robot,
Dan Carpenter, Tom Parkin
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.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202408111407.HtON8jqa-lkp@intel.com/
CC: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: James Chapman <jchapman@katalix.com>
Acked-by: Tom Parkin <tparkin@katalix.com>
---
v2: improve commit log and use acked-by tag
v1: https://lore.kernel.org/netdev/20240902142953.926891-1-jchapman@katalix.com/
---
net/l2tp/l2tp_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 32102d1ed4cd..3eec23ac5ab1 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next
2024-09-03 11:35 [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next James Chapman
@ 2024-09-03 16:35 ` Simon Horman
2024-09-04 23:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-09-03 16:35 UTC (permalink / raw)
To: James Chapman
Cc: netdev, davem, edumazet, kuba, pabeni, dsahern, kernel test robot,
Dan Carpenter, Tom Parkin
On Tue, Sep 03, 2024 at 12:35:47PM +0100, James Chapman wrote:
> 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.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/r/202408111407.HtON8jqa-lkp@intel.com/
> CC: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: James Chapman <jchapman@katalix.com>
> Acked-by: Tom Parkin <tparkin@katalix.com>
> ---
>
> v2: improve commit log and use acked-by tag
> v1: https://lore.kernel.org/netdev/20240902142953.926891-1-jchapman@katalix.com/
>
Thanks for the update.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next
2024-09-03 11:35 [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next James Chapman
2024-09-03 16:35 ` Simon Horman
@ 2024-09-04 23:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-04 23:50 UTC (permalink / raw)
To: James Chapman
Cc: netdev, davem, edumazet, kuba, pabeni, dsahern, lkp,
dan.carpenter, tparkin
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Sep 2024 12:35:47 +0100 you wrote:
> 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.
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-04 23:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 11:35 [PATCH net-next v2] l2tp: remove unneeded null check in l2tp_v2_session_get_next James Chapman
2024-09-03 16:35 ` Simon Horman
2024-09-04 23:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).