From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6467C433F5 for ; Sat, 16 Oct 2021 08:13:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DC7C960F70 for ; Sat, 16 Oct 2021 08:13:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DC7C960F70 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6310C900002; Sat, 16 Oct 2021 04:13:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E12D6B0072; Sat, 16 Oct 2021 04:13:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F742900002; Sat, 16 Oct 2021 04:13:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 416796B0071 for ; Sat, 16 Oct 2021 04:13:54 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D19D639F5D for ; Sat, 16 Oct 2021 08:13:53 +0000 (UTC) X-FDA: 78701587146.27.803E1A3 Received: from mailout2.hostsharing.net (mailout2.hostsharing.net [83.223.78.233]) by imf26.hostedemail.com (Postfix) with ESMTP id 0D4D520019C3 for ; Sat, 16 Oct 2021 08:13:53 +0000 (UTC) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by mailout2.hostsharing.net (Postfix) with ESMTPS id DC99C103C6A49; Sat, 16 Oct 2021 10:13:50 +0200 (CEST) Received: from localhost (unknown [89.246.108.87]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id B1C6160CF58F; Sat, 16 Oct 2021 10:13:50 +0200 (CEST) X-Mailbox-Line: From 7bc9f3ee15533d170bc412d6bcdd122632af169d Mon Sep 17 00:00:00 2001 Message-Id: <7bc9f3ee15533d170bc412d6bcdd122632af169d.1634370995.git.lukas@wunner.de> In-Reply-To: <202110160632.WzahPgao-lkp@intel.com> References: <202110160632.WzahPgao-lkp@intel.com> From: Lukas Wunner Date: Sat, 16 Oct 2021 10:13:27 +0200 Subject: [PATCH nf-next] netfilter: core: Fix clang warnings about unused static inlines To: "Pablo Neira Ayuso" , Jozsef Kadlecsik , Florian Westphal Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-mm@kvack.org, Nathan Chancellor X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0D4D520019C3 X-Stat-Signature: ofk7r1p15ip8w6i5mtdbnor45skeayuy Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=none; spf=none (imf26.hostedemail.com: domain of lukas@wunner.de has no SPF policy when checking 83.223.78.233) smtp.mailfrom=lukas@wunner.de X-HE-Tag: 1634372033-705821 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Unlike gcc, clang warns about unused static inlines that are not in an include file: net/netfilter/core.c:344:20: error: unused function 'nf_ingress_hook' [-Werror,-Wunused-function] static inline bool nf_ingress_hook(const struct nf_hook_ops *reg, int pf) ^ net/netfilter/core.c:353:20: error: unused function 'nf_egress_hook' [-Werror,-Wunused-function] static inline bool nf_egress_hook(const struct nf_hook_ops *reg, int pf) ^ According to commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build"), the proper resolution is to mark the affected functions as __maybe_unused. An alternative approach would be to move them to include/linux/netfilter_netdev.h, but since Pablo didn't do that in commit ddcfa710d40b ("netfilter: add nf_ingress_hook() helper function"), I'm guessing __maybe_unused is preferred. This fixes both the warning introduced by Pablo in v5.10 as well as the one recently introduced by myself with commit 42df6e1d221d ("netfilter: Introduce egress hook"). Fixes: ddcfa710d40b ("netfilter: add nf_ingress_hook() helper function") Reported-by: kernel test robot Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v5.10+ --- net/netfilter/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 3a32a813fcde..6dec9cd395f1 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -341,7 +341,8 @@ static int nf_ingress_check(struct net *net, const struct nf_hook_ops *reg, return 0; } -static inline bool nf_ingress_hook(const struct nf_hook_ops *reg, int pf) +static inline bool __maybe_unused nf_ingress_hook(const struct nf_hook_ops *reg, + int pf) { if ((pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) || (pf == NFPROTO_INET && reg->hooknum == NF_INET_INGRESS)) @@ -350,7 +351,8 @@ static inline bool nf_ingress_hook(const struct nf_hook_ops *reg, int pf) return false; } -static inline bool nf_egress_hook(const struct nf_hook_ops *reg, int pf) +static inline bool __maybe_unused nf_egress_hook(const struct nf_hook_ops *reg, + int pf) { return pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_EGRESS; } -- 2.31.1