ip6_tunnel: Correct mistake in if statement.
Subsystems (3)
PATCH v3 1/1 ip6_tunnel: Correct mistake in if statement.
Make sure t->dev->flags & IFF_UP is check first for logical reason.
mode")
--- net/ipv6/ip6_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_tunnel.c +1 -1
@@ -162,7 +162,7 @@ ip6_tnl_lookup(struct net *net, int link,return cand; t =rcu_dereference (ip6n->collect_md_tun); -if (t && t->dev->flags &IFF_UP ) +if (t && (t->dev->flags &IFF_UP ))return t; t =rcu_dereference (ip6n->tnls_wc[0 ]);
Signature · 1 line
2.28.0
Quoted 14 lines · Jamie Gloudon
Make sure
t->dev->flags&IFF_UPis check first for logical reason.Fixes 6c1cb4393cc7 ("ip6_tunnel: fix ip6 tunnel lookup in collect_mdmode")
Signed-off-by Jamie Gloudon <[email protected]>--- net/ipv6/ip6_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv6/ip6_tunnel.c +0
-0
net/ipv6/ip6_tunnel.c ip6_tnl_lookup(struct net *net, int link, · line 165
Quoted 5 lines
net/ipv6/ip6_tunnel.c +1
-1@@ -162,7 +162,7 @@ ip6_tnl_lookup(struct net *net, int link,return cand; t =rcu_dereference (ip6n->collect_md_tun); -if (t && t->dev->flags &IFF_UP ) +if (t && (t->dev->flags &IFF_UP ))
While this change makes is less ambiguous for reader, the C precedence rules are clear and & evaluated before &&.
https://en.cppreference.com/w/c/language/operator_precedence
There is nothing to fix here.
Thanks
Quoted 6 lines
net/ipv6/ip6_tunnel.c +0
-0return t; t =rcu_dereference (ip6n->tnls_wc[0 ]);Signature · 1 line
2.28.0
Quoted 25 lines · Leon Romanovsky
Quoted 14 lines · Jamie Gloudon
Make sure
t->dev->flags&IFF_UPis check first for logical reason.Fixes 6c1cb4393cc7 ("ip6_tunnel: fix ip6 tunnel lookup in collect_mdmode")
Signed-off-by Jamie Gloudon <[email protected]>--- net/ipv6/ip6_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv6/ip6_tunnel.c +0
-0net/ipv6/ip6_tunnel.c ip6_tnl_lookup(struct net *net, int link, · line 165
Quoted 5 lines
net/ipv6/ip6_tunnel.c +1
-1@@ -162,7 +162,7 @@ ip6_tnl_lookup(struct net *net, int link,return cand; t =rcu_dereference (ip6n->collect_md_tun); -if (t && t->dev->flags &IFF_UP ) +if (t && (t->dev->flags &IFF_UP ))While this change makes is less ambiguous for reader, the C precedence rules are clear and & evaluated before &&.
https://en.cppreference.com/w/c/language/operator_precedence
Quoted 10 lines
There is nothing to fix here.
Thanks
Quoted 6 lines
net/ipv6/ip6_tunnel.c +0
-0return t; t =rcu_dereference (ip6n->tnls_wc[0 ]);Signature · 1 line
2.28.0
Thanks for taking the time to review the patch.