From: Vitaly Kuznetsov Date: Mon, 19 Aug 2019 14:44:09 +0000 (+0200) Subject: Tools: hv: kvp: eliminate 'may be used uninitialized' warning X-Git-Tag: v4.14.143~19 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5b443f8c4b6faafbd9a19a2af12edfb8099c3150;p=users%2Fdwmw2%2Flinux.git 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 Signed-off-by: Sasha Levin --- diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 0ef215061fb50..1b917eaffad8d 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -867,7 +867,7 @@ kvp_get_ip_info(int family, char *if_name, int op, int sn_offset = 0; int error = 0; char *buffer; - struct hv_kvp_ipaddr_value *ip_buffer; + struct hv_kvp_ipaddr_value *ip_buffer = NULL; char cidr_mask[5]; /* /xyz */ int weight; int i;