[infiniband-diags PATCH] rdma-ndd: fix compiler warnings.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes -Wformat-security warnings, that in Debian (and Ubuntu)
are enabled by default:

src/rdma-ndd.c: In function 'update_node_desc':
src/rdma-ndd.c:149:3: error: format not a string literal and no format arguments [-Werror=format-security]
   fprintf(f, new_nd);
   ^
src/rdma-ndd.c: In function 'udev_log_fn':
src/rdma-ndd.c:247:2: error: format not a string literal and no format arguments [-Werror=format-security]
  syslog(LOG_ERR, msg);

Signed-off-by: Ana Guerrero López <ana@xxxxxxxxx>
---
 src/rdma-ndd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/rdma-ndd.c b/src/rdma-ndd.c
index d40e756..94eb3d7 100644
--- a/src/rdma-ndd.c
+++ b/src/rdma-ndd.c
@@ -145,7 +145,7 @@ static int update_node_desc(const char *device, const char *hostname, int force)
 		syslog(LOG_INFO, "%s: change (%s) -> (%s)\n",
 			device, nd, new_nd);
 		rewind(f);
-		fprintf(f, new_nd);
+		fprintf(f, "%s", new_nd);
 	}
 
 	rc = 0;
@@ -242,7 +242,7 @@ static void udev_log_fn(struct udev *ud, int priority, const char *file, int lin
 			file, line, fn);
 	if (off < MSG_MAX-1)
 		vsnprintf(msg+off, MSG_MAX-off, format, args);
-	syslog(LOG_ERR, msg);
+	syslog(LOG_ERR, "%s", msg);
 }
 
 static void setup_udev(void)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux