[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230407035058.8373-1-iccccc@hust.edu.cn>
Date: Fri, 7 Apr 2023 03:50:58 +0000
From: Haoyi Liu <iccccc@...t.edu.cn>
To: "David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: hust-os-kernel-patches@...glegroups.com, yalongz@...t.edu.cn,
error27@...il.com, Haoyi Liu <iccccc@...t.edu.cn>,
Dongliang Mu <dzm91@...t.edu.cn>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next] net/ipv6: silence 'passing zero to ERR_PTR()' warning
Smatch complains that if xfrm_lookup() returns NULL then this does a
weird thing with "err":
net/ ipv6/ icmp.c:411 icmpv6_route_lookup()
warn: passing zero to ERR_PTR()
Just return "dst2" directly instead of assigning it to"dst" and then
looking up the value of "err". No functional change.
Signed-off-by: Haoyi Liu <iccccc@...t.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@...t.edu.cn>
---
The issue is found by static analysis, and the patch is remains untested.
---
net/ipv6/icmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 1f53f2a74480..a5e77acead89 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -395,7 +395,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net,
dst2 = xfrm_lookup(net, dst2, flowi6_to_flowi(&fl2), sk, XFRM_LOOKUP_ICMP);
if (!IS_ERR(dst2)) {
dst_release(dst);
- dst = dst2;
+ return dst2;
} else {
err = PTR_ERR(dst2);
if (err == -EPERM) {
--
2.25.1
Powered by blists - more mailing lists