]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
hv_sock: Suppress bogus "may be used uninitialized" warnings
authorDexuan Cui <decui@microsoft.com>
Sat, 15 Jun 2019 05:00:57 +0000 (05:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Jun 2019 21:00:51 +0000 (14:00 -0700)
gcc 8.2.0 may report these bogus warnings under some condition:

warning: ‘vnew’ may be used uninitialized in this function
warning: ‘hvs_new’ may be used uninitialized in this function

Actually, the 2 pointers are only initialized and used if the variable
"conn_from_host" is true. The code is not buggy here.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/hyperv_transport.c

index 982a8dc49e03c470737745411a906dff48c90bd9..e4801c7261b461bc45720ac5f5b066615dbf2eb7 100644 (file)
@@ -344,8 +344,8 @@ static void hvs_open_connection(struct vmbus_channel *chan)
 
        struct sockaddr_vm addr;
        struct sock *sk, *new = NULL;
-       struct vsock_sock *vnew;
-       struct hvsock *hvs, *hvs_new;
+       struct vsock_sock *vnew = NULL;
+       struct hvsock *hvs, *hvs_new = NULL;
        int ret;
 
        if_type = &chan->offermsg.offer.if_type;