From patchwork Fri Mar 22 13:18:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13600059 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFCC23B2AD; Fri, 22 Mar 2024 13:18:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711113504; cv=none; b=rgY3e5DSjod76lJRX3kayx9W1gAcg26Z28aDviahinbzGRx4krXnZ6YWsZi8gebhVcyGZSpx/JDp9njloM6DujD+pUGQTSY42BK/b2bSCnXC/flQjYlsoMS/Hi5PDA8VQIWvkeOMxOSqV5Asklv1ffk8uB5h1d5/LVQx3O49Xxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711113504; c=relaxed/simple; bh=QkxlbL9Dz3q0VP2PaBOmanPcZ3wN5llL2k7kbQgmFS4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kL6EI4OwF+xirxKhcxuCxFAXAaS5fMfe/Go452H9/qgHWNaFM5UdgakzOen1yuCU17WRFs9sMf7UXitx6A2ZabJAh4MN15wLV4ZAcmH4tSgpn8Z+Drv4vXio5PdZrzXjAFw7Q13mNKPpdriPeD1JDLQOddTXsBgRJBN1MFrl4bI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qNjPHxbB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qNjPHxbB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DDAEC433C7; Fri, 22 Mar 2024 13:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711113503; bh=QkxlbL9Dz3q0VP2PaBOmanPcZ3wN5llL2k7kbQgmFS4=; h=From:To:Cc:Subject:Date:From; b=qNjPHxbBHGaPbBGHkNFLf5H/PUZMJpbo6UtkZvj0XJQu5FlNb281smi/D1927oI4l mlktAC1BrW53lQl5cs5ENEotjKZQ+k1kB5LfBpOD1l8daFVEobHTbKvSeLa+N9C/6/ UsYGM+dDI9w0DUJaAdQO1Fgx4/pEoT+7hjyRc/Rk6tB8hljQwQhaspdO1JKKDJTSVi lM1isxgLX/LsHWRwHGuwppXZwLvKwYwdOasHfFbucv8HLU2GvDxOkRtDlMOSAEWJGE I0tGjNKYKZ3QibhF4o3BmHRh4p5uif229XV1HDinXxdeHutrprblfgFD7AB243BHe9 5gvzcw9tlV+uA== From: Arnd Bergmann To: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Arnd Bergmann , Kunwu Chan , Joel Granados , Zhengchao Shao , Wangyang Guo , Kyle Zeng , Beniamino Galvani , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ipv4/route: avoid unused-but-set-variable warning Date: Fri, 22 Mar 2024 14:18:12 +0100 Message-Id: <20240322131817.905700-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Arnd Bergmann The log_martians variable is only used in an #ifdef, causing a 'make W=1' warning with gcc: net/ipv4/route.c: In function 'ip_rt_send_redirect': net/ipv4/route.c:880:13: error: variable 'log_martians' set but not used [-Werror=unused-but-set-variable] Change the #ifdef to an equivalent IS_ENABLED() to let the compiler see where the variable is used. Fixes: 30038fc61adf ("net: ip_rt_send_redirect() optimization") Signed-off-by: Arnd Bergmann Reviewed-by: David Ahern --- net/ipv4/route.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c8f76f56dc16..d36ace160d42 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -926,13 +926,11 @@ void ip_rt_send_redirect(struct sk_buff *skb) icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); peer->rate_last = jiffies; ++peer->n_redirects; -#ifdef CONFIG_IP_ROUTE_VERBOSE - if (log_martians && + if (IS_ENABLED(CONFIG_IP_ROUTE_VERBOSE) && log_martians && peer->n_redirects == ip_rt_redirect_number) net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n", &ip_hdr(skb)->saddr, inet_iif(skb), &ip_hdr(skb)->daddr, &gw); -#endif } out_put_peer: inet_putpeer(peer);