Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2156173ybb; Mon, 30 Mar 2020 00:12:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuxRfWem4uwtKmSR8nQ3Vu4mMbZNFz161YiA+PWz3GI4Yj9miX1nWIqqvmAZKRD6AE5Yj9b X-Received: by 2002:aca:3046:: with SMTP id w67mr6915220oiw.54.1585552360115; Mon, 30 Mar 2020 00:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585552360; cv=none; d=google.com; s=arc-20160816; b=BSCEZjoweVhlXEy2Zl9nzJrD+9TcsVgdY6BM1rtaY5CzEUXsgwZ6kYipNo8NiSGuup p6ntBzWddgMYGhA4HTAF4BHEDW6Y3Ja2tuXVHqwRR60kVlgFyC/F/TOLPkPjdUkAfHK5 nyIjfZlcaQv4SbLzJ01j1388Z26eFkCLpYC2WzxA6ir+7/1n8LPrWWij/+l4oXWaBPoB T/vQwQfCBMSfz6c3XMEoMtFcx6FOhS06wUoRLqFcbG1LKgsHvLYYgjedx0pbVf/e7vbk kJ0yNUqwDTlEO//cVLJ7lwjuo0x0F3BWpNs4Q6S54pwkSZ/UaUX0Rr8n7v3ukZ0dL7gk a+Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=9B9S8dlFmfwsDn5acHr4PFsO/uV8qg42s+7XYqjKVBM=; b=QCvSieuIAUoVVap/wDg6hMz+ZLRd6Ay3p7cmmQhvwCpo60pDtgw4hFUmRsGX8iuAWu RCR0cDm2qWvg569NT0BuylUi6JfdO215kujMz2zpfZ8Q9xqU+v8al4VvnpaB1LBCoIEz nrAyM+dQaUIPyibzT70wZrwkev4XfXYmpHEh92A+J7o/O+mqilL4EQ/jSyMKFX76BWHN rqDcrT1nbf8UhcTt4CjdG8RJR4MHxDoSscFK3bTV9muTaLweOV3aBRSgrIjA9yjblmqs br5bLZUV5ldxb+XaejyWkqdTu19tVYU1zk/W4YSKOgh8Kkm9DCxC0LksIAyNvPPhN86/ M/nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si1661313otq.134.2020.03.30.00.12.27; Mon, 30 Mar 2020 00:12:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729430AbgC3HLk (ORCPT + 99 others); Mon, 30 Mar 2020 03:11:40 -0400 Received: from ja.ssi.bg ([178.16.129.10]:59798 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728489AbgC3HLk (ORCPT ); Mon, 30 Mar 2020 03:11:40 -0400 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by ja.ssi.bg (8.15.2/8.15.2) with ESMTP id 02U7BL0O006642; Mon, 30 Mar 2020 10:11:21 +0300 Date: Mon, 30 Mar 2020 10:11:21 +0300 (EEST) From: Julian Anastasov To: Haishuang Yan cc: Simon Horman , Pablo Neira Ayuso , netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH nf-next] ipvs: fix uninitialized variable warning In-Reply-To: <1585538415-27583-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Message-ID: References: <1585538415-27583-1-git-send-email-yanhaishuang@cmss.chinamobile.com> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, 30 Mar 2020, Haishuang Yan wrote: > If outer_proto is not set, GCC warning as following: > > In file included from net/netfilter/ipvs/ip_vs_core.c:52: > net/netfilter/ipvs/ip_vs_core.c: In function 'ip_vs_in_icmp': > include/net/ip_vs.h:233:4: warning: 'outer_proto' may be used uninitialized in this function [-Wmaybe-uninitialized] > 233 | printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ > | ^~~~~~ > net/netfilter/ipvs/ip_vs_core.c:1666:8: note: 'outer_proto' was declared here > 1666 | char *outer_proto; > | ^~~~~~~~~~~ > > Fixes: 73348fed35d0 ("ipvs: optimize tunnel dumps for icmp errors") > Signed-off-by: Haishuang Yan Acked-by: Julian Anastasov Hm, my compiler does not report it: gcc version 9.1.1 > --- > net/netfilter/ipvs/ip_vs_core.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c > index d2ac530..aa6a603 100644 > --- a/net/netfilter/ipvs/ip_vs_core.c > +++ b/net/netfilter/ipvs/ip_vs_core.c > @@ -1663,7 +1663,7 @@ static int ipvs_gre_decap(struct netns_ipvs *ipvs, struct sk_buff *skb, > unsigned int offset, offset2, ihl, verdict; > bool tunnel, new_cp = false; > union nf_inet_addr *raddr; > - char *outer_proto; > + char *outer_proto = "IPIP"; > > *related = 1; > > @@ -1723,7 +1723,6 @@ static int ipvs_gre_decap(struct netns_ipvs *ipvs, struct sk_buff *skb, > if (cih == NULL) > return NF_ACCEPT; /* The packet looks wrong, ignore */ > tunnel = true; > - outer_proto = "IPIP"; > } else if ((cih->protocol == IPPROTO_UDP || /* Can be UDP encap */ > cih->protocol == IPPROTO_GRE) && /* Can be GRE encap */ > /* Error for our tunnel must arrive at LOCAL_IN */ > -- > 1.8.3.1 Regards -- Julian Anastasov