Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1
authorDexuan Cui <decui@microsoft.com>
Thu, 18 Oct 2018 05:09:32 +0000 (05:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:45:58 +0000 (19:45 +0100)
commit1081bfdb18d7a02541e010ce0fb6a1642a13dc6e
tree652acb4ca64916c6806c2c8cf21b546eedcd6c1c
parent21c53f73ea03b20cebc9a4d23a39abf05e58dfd9
Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1

[ Upstream commit 4fcba7802c3e15a6e56e255871d6c72f829b9dd8 ]

The patch fixes:

hv_kvp_daemon.c: In function 'kvp_set_ip_info':
hv_kvp_daemon.c:1305:2: note: 'snprintf' output between 41 and 4136 bytes
into a destination of size 4096

The "(unsigned int)str_len" is to avoid:

hv_kvp_daemon.c:1309:30: warning: comparison of integer expressions of
different signedness: 'int' and 'long unsigned int' [-Wsign-compare]

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/hv/hv_kvp_daemon.c