From nobody Wed Feb 11 12:31:46 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F8D3C6FD1D for ; Fri, 7 Apr 2023 03:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbjDGDyw (ORCPT ); Thu, 6 Apr 2023 23:54:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230039AbjDGDyr (ORCPT ); Thu, 6 Apr 2023 23:54:47 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0255B4C2F; Thu, 6 Apr 2023 20:54:45 -0700 (PDT) Received: from 544c38f4e6dd.us-east4-c.c.codatalab-user-runtimes.internal (152.111.245.35.bc.googleusercontent.com [35.245.111.152]) (user=iccccc@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 3373r0ch004804-3373r0ci004804 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 7 Apr 2023 11:53:08 +0800 From: Haoyi Liu To: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: hust-os-kernel-patches@googlegroups.com, yalongz@hust.edu.cn, error27@gmail.com, Haoyi Liu , Dongliang Mu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next] net/ipv6: silence 'passing zero to ERR_PTR()' warning Date: Fri, 7 Apr 2023 03:50:58 +0000 Message-Id: <20230407035058.8373-1-iccccc@hust.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FEAS-AUTH-USER: iccccc@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Dongliang Mu --- 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 =3D xfrm_lookup(net, dst2, flowi6_to_flowi(&fl2), sk, XFRM_LOOKUP_IC= MP); if (!IS_ERR(dst2)) { dst_release(dst); - dst =3D dst2; + return dst2; } else { err =3D PTR_ERR(dst2); if (err =3D=3D -EPERM) { --=20 2.25.1