From patchwork Sun Dec 15 17:19:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerry Chu X-Patchwork-Id: 301370 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 523262C007C for ; Mon, 16 Dec 2013 04:47:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884Ab3LORri (ORCPT ); Sun, 15 Dec 2013 12:47:38 -0500 Received: from mail-yh0-f74.google.com ([209.85.213.74]:49416 "EHLO mail-yh0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751679Ab3LORrh (ORCPT ); Sun, 15 Dec 2013 12:47:37 -0500 Received: by mail-yh0-f74.google.com with SMTP id a41so399719yho.1 for ; Sun, 15 Dec 2013 09:47:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=D8pI4RovX/JigdU/bmlE5Eoo8i/u9PnCeP3agp/G42o=; b=fE8iuRwtfwsoEfV9C1dF6Oeo6KZcohqmn5qbC79EjpIrAHK0HET7SHlpzLVKFJgayr bQ0oQC9Gw+LbB4GFXSh4HSRwUNCBU7foyHqzmHzqNs/RDL5hY3rNyKRpvV9S88R4qh+4 YXg2Qr4/hkh2zPvjz1zURmprlc8+5DxV+ziAeauSg66JfwkU9BEiSBrmGTNCPJOCCGF5 WLmjwU76Qq3oO4lyAXfB924XLCfnHERSxyKzd4eYDUl6os5e6YmFfOpFaMkTcp47+6M6 JfdBA0CLO6qzU9H76YF+td2na0065s61gHj5kd4YRqjgYC+cT3vAKtJTijOHlqPIbVCj nj5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=D8pI4RovX/JigdU/bmlE5Eoo8i/u9PnCeP3agp/G42o=; b=Wi/xR4jREw4O1DHudDjbEZt5K6fA95JSYGfK1KmXhVCmKb9TplS2u5nBXJ19HSgQmH VGv7PPdjTdkvUOF1jp2W4M0mP/giE5E+/51or55V2nonvCYlwFabgB5tsqekqI/V4gdN YAqMV9e1EqOW8n9m78SULKV0/AC2I3lystBn2cp/lR3bIRHHm6TszCCEWqTJRbB2htjY CtOqbU0p7K9aqCDSSvk5sDCElodthGnDCP7xex33tjemDpL7QbXo/5UfqTsUV2Bi1gOQ eYNOqTxmZAWVQJUIui+G2ZL1RUHiMI4mQCo1s/57FAbi6myMkw9XwS2P0gdPJDm5VcFd WCiw== X-Gm-Message-State: ALoCoQnYLPHmqZPtn9u91e7UM6MAfbKV/Ix/iGvkbRWSWPGaF+oIfJG4McBEoU/mTQ0mGLy+KjaqrTNlgcoZtD6jePJoqgrrvjUGpR1O7V4+3yLizaRXmZDMXboQ54GA9SbTTPjxnDpAQzhjSn5NwID60j6KBPuvIDL0xBtuH4Iig/w+LJwwMmBSw94sZw1zoHlYhKAX2iONvCss2AXivwv+dgAeBdToUw== X-Received: by 10.236.228.170 with SMTP id f40mr4179735yhq.43.1387127957971; Sun, 15 Dec 2013 09:19:17 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id k45si2746705yhn.4.2013.12.15.09.19.17 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Dec 2013 09:19:17 -0800 (PST) Received: from taipei.mtv.corp.google.com (taipei.mtv.corp.google.com [172.17.130.75]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id CE4C931C204; Sun, 15 Dec 2013 09:19:17 -0800 (PST) Received: by taipei.mtv.corp.google.com (Postfix, from userid 19823) id 7A02FA14EF; Sun, 15 Dec 2013 09:19:17 -0800 (PST) From: "H.K. Jerry Chu" To: hannes@stressinduktion.org Cc: davem@davemloft.net, netdev@vger.kernel.org, Jerry Chu Subject: [PATCH net-next] net-ipv6: Fix alleged compiler warning in ipv6_exthdrs_len() Date: Sun, 15 Dec 2013 09:19:07 -0800 Message-Id: <1387127947-2075-1-git-send-email-hkchu@google.com> X-Mailer: git-send-email 1.8.5.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jerry Chu It was reported that Commit 299603e8370a93dd5d8e8d800f0dff1ce2c53d36 ("net-gro: Prepare GRO stack for the upcoming tunneling support") triggered a compiler warning in ipv6_exthdrs_len(): net/ipv6/ip6_offload.c: In function ‘ipv6_gro_complete’: net/ipv6/ip6_offload.c:178:24: warning: ‘optlen’ may be used uninitialized in this function [-Wmaybe-u opth = (void *)opth + optlen; ^ net/ipv6/ip6_offload.c:164:22: note: ‘optlen’ was declared here int len = 0, proto, optlen; ^ Note that there was no real bug here - optlen was never uninitialized before use. (Was the version of gcc I used smarter to not complain?) Reported-by: Hannes Frederic Sowa Signed-off-by: H.K. Jerry Chu --- net/ipv6/ip6_offload.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 7540a0e..6fb4162 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -160,8 +160,8 @@ out: static int ipv6_exthdrs_len(struct ipv6hdr *iph, const struct net_offload **opps) { - struct ipv6_opt_hdr *opth = NULL; - int len = 0, proto, optlen; + struct ipv6_opt_hdr *opth = (void *)iph; + int len = 0, proto, optlen = sizeof(*iph); proto = iph->nexthdr; for (;;) { @@ -172,10 +172,7 @@ static int ipv6_exthdrs_len(struct ipv6hdr *iph, if (!((*opps)->flags & INET6_PROTO_GSO_EXTHDR)) break; } - if (opth == NULL) - opth = (void *)(iph+1); - else - opth = (void *)opth + optlen; + opth = (void *)opth + optlen; optlen = ipv6_optlen(opth); len += optlen; proto = opth->nexthdr;