Skip to content

Commit 223e660

Browse files
Christian Braunerkees
authored andcommitted
seccomp: avoid overflow in implicit constant conversion
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: 6a21cc5 ("seccomp: add a return code to trap to userspace") Signed-off-by: Christian Brauner <[email protected]> Reviewed-by: Tyler Hicks <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Will Drewry <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Cc: Tycho Andersen <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Reviewed-by: Tycho Andersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent da0c9ea commit 223e660

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/testing/selftests/seccomp/seccomp_bpf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <stdbool.h>
3636
#include <string.h>
3737
#include <time.h>
38+
#include <limits.h>
3839
#include <linux/elf.h>
3940
#include <sys/uio.h>
4041
#include <sys/utsname.h>
@@ -3077,7 +3078,7 @@ static int user_trap_syscall(int nr, unsigned int flags)
30773078
return seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog);
30783079
}
30793080

3080-
#define USER_NOTIF_MAGIC 116983961184613L
3081+
#define USER_NOTIF_MAGIC INT_MAX
30813082
TEST(user_notification_basic)
30823083
{
30833084
pid_t pid;

0 commit comments

Comments
 (0)