[oe] [PATCH v2] lmbench: Fix compilation error of gcc format-security

zhe.he at windriver.com zhe.he at windriver.com
Tue Jul 19 02:33:04 UTC 2016


From: He Zhe <zhe.he at windriver.com>

oe-core "security_flags: turn potential string format security issues
into an error" adds "-Wformat -Wformat-security -Werror=format-security"
to the default SECURITY_CFLAGS, which may cause lmbench compilation
failure.

This patch fixes lmbench's code.

Signed-off-by: He Zhe <zhe.he at windriver.com>
---
 ...ttp-Use-puts-instead-of-printf-to-avoid-f.patch | 26 ++++++++++++++++++++++
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch

diff --git a/meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch b/meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch
new file mode 100644
index 0000000..48613ef
--- /dev/null
+++ b/meta-oe/recipes-benchmark/lmbench/lmbench/lat_http-Use-puts-instead-of-printf-to-avoid-f.patch
@@ -0,0 +1,26 @@
+[PATCH] lat_http: Use puts instead of printf to avoid gcc
+format-security error
+
+Upstream-Status: Pending
+
+Signed-off-by: He Zhe <zhe.he at windriver.com>
+---
+ src/lat_http.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lat_http.c b/src/lat_http.c
+index c630d59..42e64a1 100644
+--- a/src/lat_http.c
++++ b/src/lat_http.c
+@@ -27,7 +27,7 @@ http(char *server, char *file, int prog)
+ 	sock = tcp_connect(server, prog, SOCKOPT_REUSE);
+ 	sprintf(buf, "GET /%s HTTP/1.0\r\n\r\n\n", file);
+ 	if (debug) {
+-		printf(buf);
++		printf("%s", buf);
+ 	}
+ 	write(sock, buf, strlen(buf));
+ 	while ((n = read(sock, buf, XFERSIZE)) > 0) {
+-- 
+2.8.2
+
diff --git a/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb b/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
index 24cd0b0..b5edaeb 100644
--- a/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
+++ b/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
@@ -18,6 +18,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
            file://use-base_libdir-instead-of-hardcoded-lib.patch \
            file://lmbench_result_html_report.patch \
            file://fix-lmbench-memory-check-failure.patch \
+           file://lat_http-Use-puts-instead-of-printf-to-avoid-f.patch \
 "
 SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
 SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
-- 
2.8.1




More information about the Openembedded-devel mailing list