linux/tools/testing/selftests/seccomp
YiFei Zhu 3ce4b78f73 selftests/seccomp: Fix compile warning when CC=clang
clang has -Wconstant-conversion by default, and the constant 0xAAAAAAAAA
(9 As) being converted to an int, which is generally 32 bits, results
in the compile warning:

  clang -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/  -lpthread  seccomp_bpf.c -lcap -o seccomp_bpf
  seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' changes value from 45812984490 to -1431655766 [-Wconstant-conversion]
          int kill = kill_how == KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0xAAAAAAAAA;
              ~~~~                                                         ^~~~~~~~~~~
  1 warning generated.

-1431655766 is the expected truncation, 0xAAAAAAAA (8 As), so use
this directly in the code to avoid the warning.

Fixes: 3932fcecd9 ("selftests/seccomp: Add test for unknown SECCOMP_RET kill behavior")
Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220526223407.1686936-1-zhuyifei@google.com
2022-07-27 12:12:16 -07:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
config selftests/seccomp: Update kernel config 2020-12-02 11:20:54 -08:00
Makefile selftests/seccomp: Test PTRACE_O_SUSPEND_SECCOMP without CAP_SYS_ADMIN 2022-04-29 11:28:42 -07:00
seccomp_benchmark.c selftests/seccomp: remove ARRAY_SIZE define from seccomp_benchmark 2021-12-10 17:51:09 -07:00
seccomp_bpf.c selftests/seccomp: Fix compile warning when CC=clang 2022-07-27 12:12:16 -07:00
settings selftests/seccomp: Compare bitmap vs filter overhead 2020-11-20 11:16:34 -08:00