2019-05-27 15:22:20

by Alakesh Haloi

[permalink] [raw]
Subject: [PATCH] userfaultfd: selftest: fix compiler warning

Fixes following compiler warning

userfaultfd.c: In function ‘usage’:
userfaultfd.c:126:2: warning: format not a string literal and no format
arguments [-Wformat-security]
fprintf(stderr, examples);

Signed-off-by: Alakesh Haloi <[email protected]>
---
tools/testing/selftests/vm/userfaultfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
index 5d1db824f73a..b3e6497b080c 100644
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -123,7 +123,7 @@ static void usage(void)
fprintf(stderr, "Supported <test type>: anon, hugetlb, "
"hugetlb_shared, shmem\n\n");
fprintf(stderr, "Examples:\n\n");
- fprintf(stderr, examples);
+ fprintf(stderr, "%s", examples);
exit(1);
}

--
2.17.1


2019-05-28 02:21:33

by Peter Xu

[permalink] [raw]
Subject: Re: [PATCH] userfaultfd: selftest: fix compiler warning

On Mon, May 27, 2019 at 03:18:59PM +0000, Alakesh Haloi wrote:
> Fixes following compiler warning
>
> userfaultfd.c: In function ‘usage’:
> userfaultfd.c:126:2: warning: format not a string literal and no format
> arguments [-Wformat-security]
> fprintf(stderr, examples);
>
> Signed-off-by: Alakesh Haloi <[email protected]>

Reviewed-by: Peter Xu <[email protected]>

--
Peter Xu

2019-05-28 05:37:32

by Mike Rapoport

[permalink] [raw]
Subject: Re: [PATCH] userfaultfd: selftest: fix compiler warning

On Mon, May 27, 2019 at 03:18:59PM +0000, Alakesh Haloi wrote:
> Fixes following compiler warning
>
> userfaultfd.c: In function ‘usage’:
> userfaultfd.c:126:2: warning: format not a string literal and no format
> arguments [-Wformat-security]
> fprintf(stderr, examples);
>
> Signed-off-by: Alakesh Haloi <[email protected]>

Reviewed-by: Mike Rapoport <[email protected]>

> ---
> tools/testing/selftests/vm/userfaultfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
> index 5d1db824f73a..b3e6497b080c 100644
> --- a/tools/testing/selftests/vm/userfaultfd.c
> +++ b/tools/testing/selftests/vm/userfaultfd.c
> @@ -123,7 +123,7 @@ static void usage(void)
> fprintf(stderr, "Supported <test type>: anon, hugetlb, "
> "hugetlb_shared, shmem\n\n");
> fprintf(stderr, "Examples:\n\n");
> - fprintf(stderr, examples);
> + fprintf(stderr, "%s", examples);
> exit(1);
> }
>
> --
> 2.17.1
>

--
Sincerely yours,
Mike.