blob: 24449148f27e59522f10665a468f20c9efe62ed6 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 430e05c2169ed15aaa6d7f9459edd607603cee02 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
3Date: Mon, 25 Feb 2019 10:44:33 -0600
4Subject: [PATCH] setregid01: Fix security warning for string formatting
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9GCC 8.2.0 complains with the following:
10 setregid01.c: In function 'run':
11 setregid01.c:47:3: error: format not a string literal and no format arguments [-Werror=format-security]
12 tst_res(TFAIL | TTERRNO, tc->msg);
13 ^~~~~~~
14because there is no string formatting in the message. This can
15be seen with CFLAGS set to:
16 -Wformat -Wformat-security -Werror=format-security
17as Yocto Project's Poky does, e.g.:
18 http://errors.yoctoproject.org/Errors/Details/230043/
19
20Upstream-Status: Backport [46e1eda55f188810e6bf3a939b92d604321807ae]
21
22Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
23Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>
24---
25 testcases/kernel/syscalls/setregid/setregid01.c | 4 ++--
26 1 file changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/testcases/kernel/syscalls/setregid/setregid01.c b/testcases/kernel/syscalls/setregid/setregid01.c
29index f2e41e134..8c9e11918 100644
30--- a/testcases/kernel/syscalls/setregid/setregid01.c
31+++ b/testcases/kernel/syscalls/setregid/setregid01.c
32@@ -44,9 +44,9 @@ static void run(unsigned int n)
33 TEST(SETREGID(*tc->arg1, *tc->arg2));
34
35 if (TST_RET == -1)
36- tst_res(TFAIL | TTERRNO, tc->msg);
37+ tst_res(TFAIL | TTERRNO, "%s", tc->msg);
38 else
39- tst_res(TPASS, tc->msg);
40+ tst_res(TPASS, "%s", tc->msg);
41 }
42
43 static void setup(void)
44--
452.17.1
46