public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/fallocate05: minor fix for Werror=format-security
@ 2018-06-27 15:38 Rafael David Tinoco
  2018-06-27 15:44 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael David Tinoco @ 2018-06-27 15:38 UTC (permalink / raw)
  To: ltp

In order to avoid compilation issues in tst_XXX functions:

gcc -g -O0 -fdebug-prefix-map=. -fstack-protector-strong -Wformat
-Werror=format-security-g -O2 -fno-strict-aliasing -pipe -Wall -W
-Wold-style-definition -Wdate-time -I../../../../include
-I../../../../include -I../../../../include/old/ -Wl,-z,relro
-L../../../../lib  fallocate05.c -lltp -o fallocate05
fallocate05.c: In function ‘run’:

fallocate05.c:76:4: error: format not a string literal and
	no format arguments [-Werror=format-security]
    tst_brk(TCONF, tested_flags);
    ^~~~~~~
fallocate05.c:78:3: error: format not a string literal and
	no format arguments [-Werror=format-security]
   tst_brk(TBROK | TERRNO, tested_flags);
   ^~~~~~~
fallocate05.c:80:2: error: format not a string literal and
	no format arguments [-Werror=format-security]
  tst_res(TPASS, tested_flags);

when using format-security, change "const char *" to a
pre-defined string.

Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
---
 testcases/kernel/syscalls/fallocate/fallocate05.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c
index d2d84433b..49dc44b04 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c
@@ -30,6 +30,7 @@
 
 #define MNTPOINT "mntpoint"
 #define FALLOCATE_SIZE 8192
+#define TESTED_FLAGS "fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)"
 
 static int fd;
 
@@ -37,7 +38,6 @@ static void run(void)
 {
 	char buf[FALLOCATE_SIZE];
 	ssize_t ret;
-	const char *tested_flags="fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)";
 
 	fd = SAFE_OPEN(MNTPOINT "/test_file", O_WRONLY | O_CREAT);
 
@@ -73,11 +73,11 @@ static void run(void)
 	ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, FALLOCATE_SIZE);
 	if (ret == -1) {
 		if (errno == EOPNOTSUPP)
-			tst_brk(TCONF, tested_flags);
+			tst_brk(TCONF, TESTED_FLAGS);
 
-		tst_brk(TBROK | TERRNO, tested_flags);
+		tst_brk(TBROK | TERRNO, TESTED_FLAGS);
 	}
-	tst_res(TPASS, tested_flags);
+	tst_res(TPASS, TESTED_FLAGS);
 
 	ret = write(fd, buf, 10);
 	if (ret == -1)
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH] syscalls/fallocate05: minor fix for Werror=format-security
  2018-06-27 15:38 [LTP] [PATCH] syscalls/fallocate05: minor fix for Werror=format-security Rafael David Tinoco
@ 2018-06-27 15:44 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2018-06-27 15:44 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-27 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-27 15:38 [LTP] [PATCH] syscalls/fallocate05: minor fix for Werror=format-security Rafael David Tinoco
2018-06-27 15:44 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox