Tools: hv: kvp: eliminate 'may be used uninitialized' warning

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>
This commit is contained in:
Vitaly Kuznetsov 2019-08-19 16:44:09 +02:00 committed by Sasha Levin
parent d09bc83640
commit 89eb4d8d25
1 changed files with 1 additions and 1 deletions

View File

@ -809,7 +809,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
int sn_offset = 0; int sn_offset = 0;
int error = 0; int error = 0;
char *buffer; char *buffer;
struct hv_kvp_ipaddr_value *ip_buffer; struct hv_kvp_ipaddr_value *ip_buffer = NULL;
char cidr_mask[5]; /* /xyz */ char cidr_mask[5]; /* /xyz */
int weight; int weight;
int i; int i;