Tools: hv: kvp: eliminate 'may be used uninitialized' warning
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 19 Aug 2019 14:44:09 +0000 (16:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:31:02 +0000 (10:31 +0100)
commit6be6f81601e670d11a02ce67f69cde0352f8f77a
tree9169ca1ebea498bf69327f3b4b02fef532c338a2
parentb31da50f90dd2d63811a3881472cd2f4ac448ea4
Tools: hv: kvp: eliminate 'may be used uninitialized' warning

[ Upstream commit 89eb4d8d25722a0a0194cf7fa47ba602e32a6da7 ]

When building hv_kvp_daemon GCC-8.3 complains:

hv_kvp_daemon.c: In function ‘kvp_get_ip_info.constprop’:
hv_kvp_daemon.c:812:30: warning: ‘ip_buffer’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  struct hv_kvp_ipaddr_value *ip_buffer;

this seems to be a false positive: we only use ip_buffer when
op == KVP_OP_GET_IP_INFO and it is only unset when op == KVP_OP_ENUMERATE.

Silence the warning by initializing ip_buffer to NULL.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/hv/hv_kvp_daemon.c