[Piglit] [PATCH] cl-api-enqueue-read_write-buffer: Fix GCC format-security warning.

Vinson Lee vlee at freedesktop.org
Mon Jan 27 20:15:41 PST 2014


This patch fixes this GCC format-security warning.

enqueue-read_write-buffer.c: In function ‘piglit_cl_test’:
enqueue-read_write-buffer.c:319:8: warning: format not a string literal and no format arguments [-Wformat-security]
        fprintf(stderr, test_str_read);
        ^

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/cl/api/enqueue-read_write-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cl/api/enqueue-read_write-buffer.c b/tests/cl/api/enqueue-read_write-buffer.c
index bf88d5e..f98125c 100644
--- a/tests/cl/api/enqueue-read_write-buffer.c
+++ b/tests/cl/api/enqueue-read_write-buffer.c
@@ -316,7 +316,7 @@ piglit_cl_test(const int argc,
 							sprintf(test_str_read,
 							        "Data read from buffer is not the same as data written to buffer using 0x%X as memory flags",
 							        (unsigned int)mixed_mem_flags);
-							fprintf(stderr, test_str_read);
+							fprintf(stderr, "%s", test_str_read);
 
 							printf("  Device: %s\n    mem_flags: 0x%x, offset: %d, bytes: %d \n",
 							       device_name,
-- 
1.8.3.2



More information about the Piglit mailing list