From patchwork Sun Mar 10 15:09:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 226449 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 35A0E2C0307 for ; Mon, 11 Mar 2013 02:10:05 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752857Ab3CJPJq (ORCPT ); Sun, 10 Mar 2013 11:09:46 -0400 Received: from mail.tpi.com ([70.99.223.143]:1470 "EHLO mail.tpi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837Ab3CJPJp (ORCPT ); Sun, 10 Mar 2013 11:09:45 -0400 Received: from salmon.rtg.net (mail.tpi.com [70.99.223.143]) by mail.tpi.com (Postfix) with ESMTP id BB30B32FBD4; Sun, 10 Mar 2013 08:09:31 -0700 (PDT) Received: by salmon.rtg.net (Postfix, from userid 1000) id 6DAAC203BE; Sun, 10 Mar 2013 09:09:31 -0600 (MDT) From: Tim Gardner To: linux-kernel@vger.kernel.org Cc: Tim Gardner , Wensong Zhang , Simon Horman , Julian Anastasov , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org, lvs-devel@vger.kernel.org Subject: [PATCH linux-next] ipvs: ip_vs_fill_iph_skb: Silence warning that 'iph.thoff_reasm' may be used uninitialized Date: Sun, 10 Mar 2013 09:09:05 -0600 Message-Id: <1362928145-62682-1-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 1.7.9.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If CONFIG_IP_VS_IPV6 is not defined, then ip_vs_fill_iph_skb() does not initialize all of the fields in struct ip_vs_iphdr. Silence the 'may be used uninitialized' warning in the IPV4 only case by initializing the only field that is unique to IPV6. net/netfilter/ipvs/ip_vs_pe_sip.c: In function 'ip_vs_sip_fill_param': net/netfilter/ipvs/ip_vs_pe_sip.c:87:11: warning: 'iph.thoff_reasm' may be used uninitialized in this function [-Wuninitialized] gcc version 4.6.3 Also update comment to correctly reference fragoffs. Cc: Wensong Zhang Cc: Simon Horman Cc: Julian Anastasov Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Cc: netdev@vger.kernel.org Cc: lvs-devel@vger.kernel.org Signed-off-by: Tim Gardner --- include/net/ip_vs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 108ebe8..64ca32f 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -165,14 +165,16 @@ ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) static inline void ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr) { + /* May not get initialized in all cases */ + iphdr->thoff_reasm = 0; + #ifdef CONFIG_IP_VS_IPV6 if (af == AF_INET6) { const struct ipv6hdr *iph = (struct ipv6hdr *)skb_network_header(skb); iphdr->saddr.in6 = iph->saddr; iphdr->daddr.in6 = iph->daddr; - /* ipv6_find_hdr() updates len, flags, thoff_reasm */ - iphdr->thoff_reasm = 0; + /* ipv6_find_hdr() updates len, flags, and fragoffs */ iphdr->len = 0; iphdr->flags = 0; iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,