Subject: [PATCH 5.4 151/177] seccomp: avoid overflow in implicit constant conversion

From: Greg Kroah-Hartman <[email-masked]>
Date: Mon, 16 Dec 2019 18:50:07 +0100

From: Christian Brauner <[email-masked]>

commit 223e660bc7638d126a0e4fbace4f33f2895788c4 upstream.

USER_NOTIF_MAGIC is assigned to int variables in this test so set it to INT_MAX
to avoid warnings:

seccomp_bpf.c: In function ‘user_notification_continue’:
seccomp_bpf.c:3088:26: warning: overflow in implicit constant conversion [-Woverflow]
 #define USER_NOTIF_MAGIC 116983961184613L
                          ^
seccomp_bpf.c:3572:15: note: in expansion of macro ‘USER_NOTIF_MAGIC’
  resp.error = USER_NOTIF_MAGIC;
               ^~~~~~~~~~~~~~~~

Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Signed-off-by: Christian Brauner <[email-masked]>
Reviewed-by: Tyler Hicks <[email-masked]>
Cc: Andy Lutomirski <[email-masked]>
Cc: Will Drewry <[email-masked]>
Cc: Shuah Khan <[email-masked]>
Cc: Alexei Starovoitov <[email-masked]>
Cc: Daniel Borkmann <[email-masked]>
Cc: Martin KaFai Lau <[email-masked]>
Cc: Song Liu <[email-masked]>
Cc: Yonghong Song <[email-masked]>
Cc: Tycho Andersen <[email-masked]>
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Reviewed-by: Tycho Andersen <[email-masked]>
Link: https://lore.kernel.org/r/[email-masked]
Signed-off-by: Kees Cook <[email-masked]>
Signed-off-by: Greg Kroah-Hartman <[email-masked]>

---
 tools/testing/selftests/seccomp/seccomp_bpf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 #include <string.h>
 #include <time.h>
+#include <limits.h>
 #include <linux/elf.h>
 #include <sys/uio.h>
 #include <sys/utsname.h>
@@ -3077,7 +3078,7 @@ static int user_trap_syscall(int nr, uns
 	return seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog);
 }
 
-#define USER_NOTIF_MAGIC 116983961184613L
+#define USER_NOTIF_MAGIC INT_MAX
 TEST(user_notification_basic)
 {
 	pid_t pid;