Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034345AbcJRSVX (ORCPT ); Tue, 18 Oct 2016 14:21:23 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:45050 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030378AbcJRSVM (ORCPT ); Tue, 18 Oct 2016 14:21:12 -0400 Date: Tue, 18 Oct 2016 14:21:10 -0400 (EDT) Message-Id: <20161018.142110.10381887028686813.davem@davemloft.net> To: arnd@arndb.de Cc: kys@microsoft.com, haiyangz@microsoft.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, vkuznets@redhat.com, stephen@networkplumber.org, sixiao@microsoft.com, devel@linuxdriverproject.org, netdev@vger.kernel.org Subject: Re: [PATCH 21/28] net/hyperv: avoid uninitialized variable From: David Miller In-Reply-To: <20161017221650.1902729-2-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> <20161017221650.1902729-2-arnd@arndb.de> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-7 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 18 Oct 2016 11:21:11 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u9IILTJG012691 Content-Length: 824 Lines: 20 From: Arnd Bergmann Date: Tue, 18 Oct 2016 00:16:09 +0200 > The hdr_offset variable is only if we deal with a TCP or UDP packet, > but as the check surrounding its usage tests for skb_is_gso() > instead, the compiler has no idea if the variable is initialized > or not at that point: > > drivers/net/hyperv/netvsc_drv.c: In function ?netvsc_start_xmit?: > drivers/net/hyperv/netvsc_drv.c:494:42: error: ?hdr_offset? may be used uninitialized in this function [-Werror=maybe-uninitialized] > > This adds an additional check for the transport type, which > tells the compiler that this path cannot happen. Since the > get_net_transport_info() function should always be inlined > here, I don't expect this to result in additional runtime > checks. > > Signed-off-by: Arnd Bergmann Applied.