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

Tom Stellard tom at stellard.net
Tue Jan 28 06:40:35 PST 2014


On Mon, Jan 27, 2014 at 08:15:41PM -0800, Vinson Lee wrote:
> 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);
>         ^
> 
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> 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
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list