From patchwork Mon Oct 17 22:16:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101671 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp597279qge; Mon, 17 Oct 2016 15:17:32 -0700 (PDT) X-Received: by 10.66.248.69 with SMTP id yk5mr35001558pac.9.1476742652504; Mon, 17 Oct 2016 15:17:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci5si27082400pad.250.2016.10.17.15.17.32; Mon, 17 Oct 2016 15:17:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759174AbcJQWR0 (ORCPT + 4 others); Mon, 17 Oct 2016 18:17:26 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:61111 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758713AbcJQWRW (ORCPT ); Mon, 17 Oct 2016 18:17:22 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0MVLxe-1cSgEn2BxO-00Yjw8; Tue, 18 Oct 2016 00:17:07 +0200 From: Arnd Bergmann To: "K. Y. Srinivasan" , Haiyang Zhang Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , "David S. Miller" , Vitaly Kuznetsov , stephen hemminger , "sixiao@microsoft.com" , devel@linuxdriverproject.org, netdev@vger.kernel.org Subject: [PATCH 21/28] net/hyperv: avoid uninitialized variable Date: Tue, 18 Oct 2016 00:16:09 +0200 Message-Id: <20161017221650.1902729-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:YuqX1/W6xHY+ZxfvFwH6b6JdMsCU/D0hXKA03mBv7okbtn/2IRD wYzhjcb+Dt8LhmICB5cW9XIRzQAYim1gI3Xq+Y+tw9XCxzF8Q9jzoLgm1eXH5Q7fDIUB7j3 fqZV8MEe6v5amZWocsL3pha5qUP2En9D7FbapCjOfm9lYVWKI8QLl0uBO6UnPJSyuVv7881 alQi9ashGuzU3RHO56pfg== X-UI-Out-Filterresults: notjunk:1; V01:K0:UO5m1pLRMOs=:+tJHxWt8BQkEbjL5azUxcb MCTkw6kjf0uJ9paGDVuCsPx1HL9T4CmAxQO51vwZtLhrBjWW5NRKzfseTUEd+WnwU/A9bvkq2 0k/J4Firhl5Z1i3ZcbUtK6H4OcDolo1aJ8qUnGCjnqq6tWcs6aD8V0aKwlxdK10MBnVhvGBvH s2MG2S2rsouSyhCUK+Lh3njfJMy1UCejshQnhzQMxeb41RAqnr+C59nyDMKTN3NfnE5kRspys R8qaTrW9m3jpaFDujQ9pXyVn2WgVsju5zd0LXDyVrL5TgHLBFAfkwLWaU/Es/Wzg0ZQQQkTNh Czu1RmRkd0MKnMFZ1d6RIp5CJLg/+ucFMgyeYFAN8fbicN80XyNvDUJZWpeFyGfAyN/180KFf 2eAcndQWNSAQxHq8Atj87cIy5Wgf1OpwDjVGGRLuzcDZcSEVtrgPDDrtq3oL++m9rIm60fXuU GtMZwVgXWjg3JDE1AtiI8PUwGM8cQCGzRjAKqtZDkMI2IZuLM4sc7BYbh8ypV92Lo3MQYNwhc LPaU8Qf8rH6gMMM9yJhIB0av6Qrpg1kulWVMgtOVqGW/qBMpAehbAzoFjurF1+QDkZAeMMhTK dWaXG1xzuJRQYF9CbeWPW9Uy5ganDhlZ+Bv7CbtJ7z5rGXfEW9b6/PZVVHzRN1UwRR57jVa6O 0j7bcCt55HGwkzyOHfjfDrNaHRy1SiZUhi1EbLeexIFGzYii4VAHYqR9nFsQ4IrTiD8M1Hl6m J+dTHSLK7P37+IM6 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- drivers/net/hyperv/netvsc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index f0919bd..5d6e75a 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -447,7 +447,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) * Setup the sendside checksum offload only if this is not a * GSO packet. */ - if (skb_is_gso(skb)) { + if ((net_trans_info & (INFO_TCP | INFO_UDP)) && skb_is_gso(skb)) { struct ndis_tcp_lso_info *lso_info; rndis_msg_size += NDIS_LSO_PPI_SIZE;