* [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings
@ 2019-06-15 5:00 Dexuan Cui
2019-06-15 7:19 ` Sunil Muthuswamy
2019-06-16 21:01 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Dexuan Cui @ 2019-06-15 5:00 UTC (permalink / raw)
To: netdev, davem, Michael Kelley
Cc: linux-hyperv, linux-kernel, KY Srinivasan, Stephen Hemminger,
Haiyang Zhang, Sasha Levin, olaf, apw, jasowang, vkuznets,
marcelo.cerri, Dexuan Cui
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>
---
net/vmw_vsock/hyperv_transport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index 8d1ea9eda8a2..cd3f47f54fa7 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -329,8 +329,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;
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings
2019-06-15 5:00 [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings Dexuan Cui
@ 2019-06-15 7:19 ` Sunil Muthuswamy
2019-06-16 21:01 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Sunil Muthuswamy @ 2019-06-15 7:19 UTC (permalink / raw)
To: Dexuan Cui, netdev, davem, Michael Kelley
Cc: linux-hyperv, linux-kernel, KY Srinivasan, Stephen Hemminger,
Haiyang Zhang, Sasha Levin, olaf, apw, jasowang, vkuznets,
marcelo.cerri
> -----Original Message-----
> From: linux-hyperv-owner@vger.kernel.org <linux-hyperv-owner@vger.kernel.org> On Behalf Of Dexuan Cui
> Sent: Friday, June 14, 2019 10:01 PM
> To: netdev@vger.kernel.org; davem@davemloft.net; Michael Kelley <mikelley@microsoft.com>
> Cc: linux-hyperv@vger.kernel.org; linux-kernel@vger.kernel.org; KY Srinivasan <kys@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>; Sasha Levin <Alexander.Levin@microsoft.com>;
> olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com; vkuznets <vkuznets@redhat.com>; marcelo.cerri@canonical.com;
> Dexuan Cui <decui@microsoft.com>
> Subject: [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings
>
> 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>
> ---
> net/vmw_vsock/hyperv_transport.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
> index 8d1ea9eda8a2..cd3f47f54fa7 100644
> --- a/net/vmw_vsock/hyperv_transport.c
> +++ b/net/vmw_vsock/hyperv_transport.c
> @@ -329,8 +329,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;
>
These are all already fixed under
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=ac383f58f3c98de37fa67452acc5bd677396e9f3
Its just that that commit hasn't merged with the 'net' branch yet.
> if_type = &chan->offermsg.offer.if_type;
> --
> 2.19.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings
2019-06-15 5:00 [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings Dexuan Cui
2019-06-15 7:19 ` Sunil Muthuswamy
@ 2019-06-16 21:01 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-16 21:01 UTC (permalink / raw)
To: decui
Cc: netdev, mikelley, linux-hyperv, linux-kernel, kys, sthemmin,
haiyangz, Alexander.Levin, olaf, apw, jasowang, vkuznets,
marcelo.cerri
From: Dexuan Cui <decui@microsoft.com>
Date: Sat, 15 Jun 2019 05:00:57 +0000
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-16 21:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-15 5:00 [PATCH net] hv_sock: Suppress bogus "may be used uninitialized" warnings Dexuan Cui
2019-06-15 7:19 ` Sunil Muthuswamy
2019-06-16 21:01 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).