Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp359738rwl; Thu, 6 Apr 2023 21:08:06 -0700 (PDT) X-Google-Smtp-Source: AKy350aKIZZCbN5hAX5hHqSYRbRP52ioHS5Ho4cywpAPE/Zn+Az7wT2PYhPUSb5YSZKnKZbaWMjZ X-Received: by 2002:aa7:c647:0:b0:4fc:6475:d249 with SMTP id z7-20020aa7c647000000b004fc6475d249mr1501526edr.3.1680840485797; Thu, 06 Apr 2023 21:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680840485; cv=none; d=google.com; s=arc-20160816; b=jkGJx79FasxspiaYP7xAFkTMf1EpcPVU5tbzyDyQ35+NOA858dX0wWPErZU0wHxW8l IB0HsyZvKPTGdL6UzYAL6DxjG1kezzMBtW+vOebDir5VTW/En/xFRHT1fC55sTEzPI33 sspSsWKU9jhSUJeztisC6SmnJXbOvm2paAVhdPP9KhPz4WayGj6pQt7Ah2Rpg93I6I1m iKqfietVUL4sIGEMCTnkftW+dOw0w047FoJAz/jCclqAYYUIVDjkWe18fDgcZJWUWGMF bSSCEJvWAcSqwmkRuGmh65IV+rJeKAzCqQIkJRhnDhTy0u506E/JR9kcVWh038mldDKh tddQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=w9FxMP9zYpGQPxdB386OdHgHirRaIJaaSVmtivAMwsQ=; b=tH8QGlspQynCzUtuQCXAd4boR6Yy8nGLO8w2zSmejsAp4JLXOAUthYiYSJ0PA6O2J2 Q3FNdZ0b29mihtf1VTODbKoE3GfsqLNavCVDhFLz9O9+RRdixc6NeKM/KzNsUOqHb/MA MHMi9NyWBMxUmyfQBgWfCdXORdW5YKVdSaHVuxBKs7VDAMv7lC9pxdcI95ucjDxbrOSb Hg2yD37I5qyzHDPloH8m4E5xVAQ0jurNxkfOLySOlD03ySRShJOJHEgwtkKDQJDlk+J/ dIle+9PFxOr2MWyjAInt/eQlg8pfg5WwbdQzteqb8V/KKpEm5N3SMIxkxoOlGPa4t3iS 3R5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a50fa93000000b004aaa505ac5fsi2760878edr.76.2023.04.06.21.07.35; Thu, 06 Apr 2023 21:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbjDGDyv (ORCPT + 99 others); Thu, 6 Apr 2023 23:54:51 -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: 8bit X-FEAS-AUTH-USER: iccccc@hust.edu.cn X-Spam-Status: No, score=1.0 required=5.0 tests=HK_RANDOM_ENVFROM, HK_RANDOM_FROM,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = 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