Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759341AbcJQWRa (ORCPT ); Mon, 17 Oct 2016 18:17:30 -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 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1359 Lines: 34 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(-) 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; -- 2.9.0