selftests: seccomp: fix format-zero-length warnings
Subsystems (2)
PATCH 1/1 selftests: seccomp: fix format-zero-length warnings
seccomp_benchmark.c:197:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
197 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
202 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
204 | ksft_print_msg("");
| ^~
--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/seccomp/seccomp_benchmark.c +3 -3
@@ -194,14 +194,14 @@ int main(int argc, char *argv[])ksft_set_plan (7 );ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" ); +ksft_print_msg (" " );system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" ); +ksft_print_msg (" " );system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" ); +ksft_print_msg (" " );system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();
Signature · 1 line
2.43.0
Shuah Khan
maintainerQuoted 25 lines · Amer Al Shanawany
seccomp_benchmark.c:197:24: warning: zero-length
gnu_printfformat
string [-Wformat-zero-length]
197 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
202 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
204 |ksft_print_msg("");
| ^~Reported-by kernel test robot <[email protected]>Signed-off-by Amer Al Shanawany <[email protected]>--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-0
tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 197
Quoted 5 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +1
-1@@ -194,14 +194,14 @@ int main(int argc, char *argv[])ksft_set_plan (7 );ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" ); +ksft_print_msg (" " );
Why not delete this all together?
tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 202
Quoted 6 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +1
-1system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" ); +ksft_print_msg (" " );
Why not delete this all together?
tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 204
Quoted 3 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +1
-1system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" ); +ksft_print_msg (" " );
Why not delete this all together?
tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 207
Quoted 3 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-0system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();
thanks,
-- Shuah
PATCH v2 1/1 selftests: seccomp: fix format-zero-length warnings
fix the following errors by removing empty print statements:
seccomp_benchmark.c:197:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
197 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
202 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
204 | ksft_print_msg("");
| ^~
---
Changes v1 -> v2:
removed empty print statements
--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 3 --- 1 file changed, 3 deletions(-)
tools/testing/selftests/seccomp/seccomp_benchmark.c +0 -3
@@ -194,14 +194,11 @@ int main(int argc, char *argv[])ksft_set_plan (7 );ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" );system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();
Signature · 1 line
2.43.0
Shuah Khan
maintainerQuoted 14 lines · Amer Al Shanawany
fix the following errors by removing empty print statements:
seccomp_benchmark.c:197:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
197 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
202 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
204 |ksft_print_msg("");
| ^~
Quoted 6 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Amer Al Shanawany <[email protected]>---
Changes v1 -> v2:
removed empty print statements
Kees,
Is this change okay with you. I didn't see any use for these empty ksft_print_msg().
I will take this patch if you are okay with the change.
Quoted 13 lines
--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 3 --- 1 file changed, 3 deletions(-)tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-1@@ -194,14 +194,11 @@ int main(int argc, char *argv[])ksft_set_plan (7 );ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" );
tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 204
Quoted 10 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-2system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();
thanks,
-- Shuah
Kees Cook
maintainerQuoted 22 lines · Shuah Khan
Quoted 14 lines · Amer Al Shanawany
fix the following errors by removing empty print statements:
seccomp_benchmark.c:197:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
197 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
202 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
204 |ksft_print_msg("");
| ^~Quoted 6 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Amer Al Shanawany <[email protected]>---
Changes v1 -> v2:
removed empty print statements
Quoted 6 lines
Kees,
Is this change okay with you. I didn't see any use for these empty
ksft_print_msg().I will take this patch if you are okay with the change.
Dropping these means that the "#" marks go missing. Currently:
# Running on:
# Linux proton 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
with the proposed patch:
# Running on:
Linux proton 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
This breaks the TAP syntax for the test, so we should find a different solution.
Perhaps:
ksft_print_msg("%s", "");
?
-Kees
Quoted 25 lines
Quoted 11 lines
--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 3 --- 1 file changed, 3 deletions(-)tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-0@@ -194,14 +194,11 @@ int main(int argc, char *argv[])ksft_set_plan (7 );tools/testing/selftests/seccomp/seccomp_benchmark.c int main(int argc, char *argv[]) · line 201
Quoted 10 lines
tools/testing/selftests/seccomp/seccomp_benchmark.c +0
-3ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" );system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" );system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();thanks,
-- Shuah
Signature · 1 line
Kees Cook
Shuah Khan
maintainerQuoted 40 lines · Kees Cook
Quoted 22 lines · Shuah Khan
Quoted 14 lines · Amer Al Shanawany
fix the following errors by removing empty print statements:
seccomp_benchmark.c:197:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]197 | ksft_print_msg(""); | ^~ seccomp_benchmark.c:202:24: warning: zero-length gnu_printf format string [-Wformat-zero-length] 202 | ksft_print_msg(""); | ^~ seccomp_benchmark.c:204:24: warning: zero-length gnu_printf format string [-Wformat-zero-length] 204 | ksft_print_msg(""); | ^~Quoted 6 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Amer Al Shanawany <[email protected]>---
Changes v1 -> v2:
removed empty print statementsQuoted 6 lines
Kees,
Is this change okay with you. I didn't see any use for these empty
ksft_print_msg().I will take this patch if you are okay with the change.
Dropping these means that the "#" marks go missing. Currently:
# Running on:
# Linux proton 6.5.0-25-generic #25~22.04.1-Ubuntu SMPPREEMPT_DYNAMICTue Feb 20 16:09:15 UTC 2x86_64x86_64x86_64GNU/Linuxwith the proposed patch:
# Running on:
Linux proton 6.5.0-25-generic #25~22.04.1-Ubuntu SMPPREEMPT_DYNAMICTue Feb 20 16:09:15 UTC 2x86_64x86_64x86_64GNU/Linux
Quoted 9 lines
This breaks the TAP syntax for the test, so we should find a different solution.
Perhaps:
ksft_print_msg("%s", "");?
Thank you Kees. Yes that would work.
Amer, please send me v3 based on Kees's suggestions.
thanks,
-- Shuah
PATCH v3 1/1 selftests: seccomp: fix format-zero-length warnings
fix the following errors by using string format specifier and an empty parameter:
seccomp_benchmark.c:197:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
197 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
202 | ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-length gnu_printf format
string [-Wformat-zero-length]
204 | ksft_print_msg("");
| ^~
---
v1 -> v2: removed empty print statements
v2 -> v3: used Kees's suggestion
--- tools/testing/selftests/seccomp/seccomp_benchmark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/seccomp/seccomp_benchmark.c +3 -3
@@ -194,14 +194,14 @@ int main(int argc, char *argv[])ksft_set_plan (7 );ksft_print_msg ("Running on:\n" ); -ksft_print_msg ("" ); +ksft_print_msg ("%s" ,"" );system ("uname -a" );ksft_print_msg ("Current BPF sysctl settings:\n" );/* Avoid using "sysctl" which may not be installed. */ -ksft_print_msg ("" ); +ksft_print_msg ("%s" ,"" );system ("grep -H . /proc/sys/net/core/bpf_jit_enable" ); -ksft_print_msg ("" ); +ksft_print_msg ("%s" ,"" );system ("grep -H . /proc/sys/net/core/bpf_jit_harden" );affinity ();
Signature · 1 line
2.43.0
Quoted 16 lines · Amer Al Shanawany
fix the following errors by using string format specifier and an empty parameter:
seccomp_benchmark.c:197:24: warning: zero-length
gnu_printfformat
string [-Wformat-zero-length]
197 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:202:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
202 |ksft_print_msg("");
| ^~
seccomp_benchmark.c:204:24: warning: zero-lengthgnu_printfformat
string [-Wformat-zero-length]
204 |ksft_print_msg("");
| ^~
Quoted 4 lines
Reported-by kernel test robot <[email protected]>Suggested-by Kees Cook <[email protected]>Signed-off-by Amer Al Shanawany <[email protected]>
Thanks!
Signature · 1 line
Kees Cook