]> git.baikalelectronics.ru Git - kernel.git/commit
net/hyperv: avoid uninitialized variable
authorArnd Bergmann <arnd@arndb.de>
Mon, 17 Oct 2016 22:16:09 +0000 (00:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Oct 2016 18:20:36 +0000 (14:20 -0400)
commitba63aab82660ba07e9734207c51c35443492cd0e
treea46c349e5eda98851b968156a82b5239eb585806
parent84a4652a5c92f544c7cd9ecd2ea461346e84112c
net/hyperv: avoid uninitialized variable

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 <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c