Skip to content

Commit 89eb4d8

Browse files
vittyvkSasha Levin
authored andcommitted
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>
1 parent d09bc83 commit 89eb4d8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/hv/hv_kvp_daemon.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
809809
int sn_offset = 0;
810810
int error = 0;
811811
char *buffer;
812-
struct hv_kvp_ipaddr_value *ip_buffer;
812+
struct hv_kvp_ipaddr_value *ip_buffer = NULL;
813813
char cidr_mask[5]; /* /xyz */
814814
int weight;
815815
int i;

0 commit comments

Comments
 (0)