summaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_core.c
diff options
context:
space:
mode:
authorJames Chapman <jchapman@katalix.com>2024-09-03 13:35:47 +0200
committerJakub Kicinski <kuba@kernel.org>2024-09-05 01:39:32 +0200
commit510c0732fc8cabe7bca8de291c74d3f3cc36df48 (patch)
tree8388d52b5eb7280b7f68839c7be58483013caa61 /net/l2tp/l2tp_core.c
parentnet: mana: Improve mana_set_channels() in low mem conditions (diff)
downloadlinux-510c0732fc8cabe7bca8de291c74d3f3cc36df48.tar.xz
linux-510c0732fc8cabe7bca8de291c74d3f3cc36df48.zip
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. 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> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20240903113547.1261048-1-jchapman@katalix.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/l2tp/l2tp_core.c')
-rw-r--r--net/l2tp/l2tp_core.c2
1 files changed, 1 insertions, 1 deletions
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 @@ again:
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;