RE: [PATCH net] hvsock: fix epollout hang from race condition

From: Dexuan Cui
Date: Fri Jun 14 2019 - 23:27:30 EST


> From: linux-hyperv-owner@xxxxxxxxxxxxxxx
> <linux-hyperv-owner@xxxxxxxxxxxxxxx> On Behalf Of David Miller
> Sent: Friday, June 14, 2019 7:15 PM
> To: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
>
> This adds lots of new warnings:
>
> net/vmw_vsock/hyperv_transport.c: In function ʽhvs_probeʼ:
> net/vmw_vsock/hyperv_transport.c:205:20: warning: ʽvnewʼ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> remote->svm_port = host_ephemeral_port++;
> ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
> net/vmw_vsock/hyperv_transport.c:332:21: note: ʽvnewʼ was declared here
> struct vsock_sock *vnew;
> ^~~~
> net/vmw_vsock/hyperv_transport.c:406:22: warning: ʽhvs_newʼ may be
> used uninitialized in this function [-Wmaybe-uninitialized]
> hvs_new->vm_srv_id = *if_type;
> ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
> net/vmw_vsock/hyperv_transport.c:333:23: note: ʽhvs_newʼ was declared
> here
> struct hvsock *hvs, *hvs_new;
> ^~~~~~~

Hi David,
These warnings are not introduced by this patch from Sunil.

I'm not sure why I didn't notice these warnings before.
Probably my gcc version is not new eought?

Actually these warnings are bogus, as I checked the related functions,
which may confuse the compiler's static analysis.

I'm going to make a patch to initialize the pointers to NULL to suppress
the warnings. My patch will be based on the latest's net.git + this patch
from Sunil.

Thanks,
-- Dexuan