From nobody Sat Feb 7 07:10:28 2026 Received: from michel.telenet-ops.be (michel.telenet-ops.be [195.130.137.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE593139B for ; Sun, 12 Jan 2025 12:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.88 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736683410; cv=none; b=WDv0xBu/G7yu6Lccq5mamrdiHii3uqGJok6rDW2uII9AUsW4513OXqIcO8TSJT3L/3QQ3S8bk7pA1vr5xABO7L97aYIr57uwvLfUpWPNL5OYbOrotfnBSovfqKYsxmK544H2+p8ezK+VSBbFhCVorARWhi6f7tBXxEDPPn+vjCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736683410; c=relaxed/simple; bh=X2vllrUPWyE4qJGq6kL3ctHerw59PCqTWLtpwbJy6GM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=AidPrFeH0rIuwPlQsgtrJmHtR8JtiyWDyprgIaijT1VzoaxmHW0oyICKt8QHMbdMbas36LcgIBZ+zDGf+pwg4ACpTOR5TWnoigMSmX8Nz5G1qtJvQiSioGyhn8AvQSC9/+PmtOvKVrk0pRBTKLaOdlJencKXjbWs8bk3T11WKXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:f7a6:44d1:35dc:44f6]) by michel.telenet-ops.be with cmsmtp id 0C3J2E00123R5sA06C3JXL; Sun, 12 Jan 2025 13:03:18 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.97) (envelope-from ) id 1tWwgT-0000000Ayx9-3ZHY; Sun, 12 Jan 2025 13:03:17 +0100 Received: from geert by rox.of.borg with local (Exim 4.97) (envelope-from ) id 1tWtuB-0000000AirA-0I5D; Sun, 12 Jan 2025 10:05:11 +0100 From: Geert Uytterhoeven To: "David S . Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , kernel test robot Subject: [PATCH] ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only Date: Sun, 12 Jan 2025 10:05:10 +0100 Message-ID: <3dc917cf6244ef123aa955b2fbbf02473d13cdb5.1736672666.git.geert@linux-m68k.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable if CONFIG_NET_IPGRE is enabled, but CONFIG_IPV6 is disabled: net/ipv4/ip_gre.c: In function =E2=80=98ipgre_err=E2=80=99: net/ipv4/ip_gre.c:144:22: error: variable =E2=80=98data_len=E2=80=99 se= t but not used [-Werror=3Dunused-but-set-variable] 144 | unsigned int data_len =3D 0; | ^~~~~~~~ Fix this by moving all data_len processing inside the IPV6-only section that uses its result. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202501121007.2GofXmh5-lkp@int= el.com/ Signed-off-by: Geert Uytterhoeven --- net/ipv4/ip_gre.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index f1f31ebfc7934467..6f871af7bb5772b7 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -141,7 +141,6 @@ static int ipgre_err(struct sk_buff *skb, u32 info, const struct iphdr *iph; const int type =3D icmp_hdr(skb)->type; const int code =3D icmp_hdr(skb)->code; - unsigned int data_len =3D 0; struct ip_tunnel *t; =20 if (tpi->proto =3D=3D htons(ETH_P_TEB)) @@ -182,7 +181,6 @@ static int ipgre_err(struct sk_buff *skb, u32 info, case ICMP_TIME_EXCEEDED: if (code !=3D ICMP_EXC_TTL) return 0; - data_len =3D icmp_hdr(skb)->un.reserved[1] * 4; /* RFC 4884 4.1 */ break; =20 case ICMP_REDIRECT: @@ -191,8 +189,9 @@ static int ipgre_err(struct sk_buff *skb, u32 info, =20 #if IS_ENABLED(CONFIG_IPV6) if (tpi->proto =3D=3D htons(ETH_P_IPV6) && - !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4 + tpi->hdr_len, - type, data_len)) + !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4 + tpi->hdr_len, type, + type =3D=3D ICMP_TIME_EXCEEDED ? + icmp_hdr(skb)->un.reserved[1] * 4 /* RFC 4884 4.1 */ : 0)) return 0; #endif =20 --=20 2.43.0