[PATCH] tests: fix format warning in macros

Dmitry V. Levin ldv at altlinux.org
Sat Sep 21 16:13:26 UTC 2019


On Sat, Sep 21, 2019 at 03:00:51PM +0200, Paul Chaignon wrote:
> tests/prctl-seccomp-filter-v.c (PRINT_ALLOW_SYSCALL, PRINT_DENY_SYSCALL):
> Fix format warning.
> tests/seccomp-filter-v.c (PRINT_ALLOW_SYSCALL, PRINT_DENY_SYSCALL):
> Likewise.
> 
> Signed-off-by: Paul Chaignon <paul.chaignon at gmail.com>
> ---
> Two of the Travis CI builds are failing on the master branch because of
> this warning.
> 
>  tests/prctl-seccomp-filter-v.c |  8 ++++----
>  tests/seccomp-filter-v.c       | 12 ++++++------
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/prctl-seccomp-filter-v.c b/tests/prctl-seccomp-filter-v.c
> index 6e1affc0..61e0ae3c 100644
> --- a/tests/prctl-seccomp-filter-v.c
> +++ b/tests/prctl-seccomp-filter-v.c
> @@ -43,14 +43,14 @@
>  		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
>  
>  # define PRINT_ALLOW_SYSCALL(nr) \
> -	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
> +	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
>  	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
> -	       __NR_ ## nr)
> +	       (long) __NR_ ## nr)
>  
>  # define PRINT_DENY_SYSCALL(nr, err) \
> -	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
> +	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
>  	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
> -	       __NR_ ## nr, err)
> +	       (long) __NR_ ## nr, err)
>  
>  static const struct sock_filter filter[] = {
>  	/* load syscall number */
> diff --git a/tests/seccomp-filter-v.c b/tests/seccomp-filter-v.c
> index f3adce44..f8bd7834 100644
> --- a/tests/seccomp-filter-v.c
> +++ b/tests/seccomp-filter-v.c
> @@ -43,14 +43,14 @@
>  		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
>  
>  # define PRINT_ALLOW_SYSCALL(nr) \
> -	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
> -	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
> -	       __NR_ ## nr)
> +	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
> +	        "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
> +	        (long) __NR_ ## nr)
>  
>  # define PRINT_DENY_SYSCALL(nr, err) \
> -	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
> -	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
> -	       __NR_ ## nr, err)
> +	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#lx, 0, 0x1), " \
> +	        "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
> +	        (long) __NR_ ## nr, err)
>  
>  static const struct sock_filter filter_c[] = {
>  	/* load syscall number */

The patch looks fine, but I wonder where do these warnings come from?
Has the type of __NR_* macros changed suddenly from int to long?
Given that the warning arises on x32 only,
is it related to the type of __X32_SYSCALL_BIT?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190921/9df683f2/attachment.bin>


More information about the Strace-devel mailing list