Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503652 > unrolled thread

[PATCH 2/3] tools: hv: fix a compile warning in snprintf

Started byWeibing Zhang <atheism.zhang@gmail.com>
First post2016-10-19 16:30 +0200
Last post2016-10-19 16:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] tools: hv: fix a compile warning in snprintf Weibing Zhang <atheism.zhang@gmail.com> - 2016-10-19 16:30 +0200

#1503652 — [PATCH 2/3] tools: hv: fix a compile warning in snprintf

FromWeibing Zhang <atheism.zhang@gmail.com>
Date2016-10-19 16:30 +0200
Subject[PATCH 2/3] tools: hv: fix a compile warning in snprintf
Message-ID<su02t-2rf-19@gated-at.bofh.it>
hv_kvp_daemon.c: In function ‘kvp_mac_to_if_name’:
hv_kvp_daemon.c:705:2: warning: format not a string literal and no format arguments [-Wformat-security]
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  ^
hv_kvp_daemon.c:705:2: warning: format not a string literal and no format arguments [-Wformat-security]

Signed-off-by: Weibing Zhang <atheism.zhang@gmail.com>
---
 tools/hv/hv_kvp_daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index bc7adb8..bb0719b 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -702,7 +702,7 @@ static char *kvp_mac_to_if_name(char *mac)
 	if (dir == NULL)
 		return NULL;
 
-	snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
+	snprintf(dev_id, sizeof(dev_id), "%s", kvp_net_dir);
 	q = dev_id + strlen(kvp_net_dir);
 
 	while ((entry = readdir(dir)) != NULL) {
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web