Skip to content

Commit 49f731f

Browse files
masahir0yKAGA-KOKO
authored andcommitted
x86/syscalls: Use __NR_syscalls instead of __NR_syscall_max
__NR_syscall_max is only used by x86 and UML. In contrast, __NR_syscalls is widely used by all the architectures. Convert __NR_syscall_max to __NR_syscalls and adjust the usage sites. This prepares x86 to switch to the generic syscallhdr.sh script. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210517073815.97426-6-masahiroy@kernel.org
1 parent f63815e commit 49f731f

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

arch/um/kernel/skas/syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void handle_syscall(struct uml_pt_regs *r)
4141
goto out;
4242

4343
syscall = UPT_SYSCALL_NR(r);
44-
if (syscall >= 0 && syscall <= __NR_syscall_max)
44+
if (syscall >= 0 && syscall < __NR_syscalls)
4545
PT_REGS_SET_SYSCALL_RETURN(regs,
4646
EXECUTE_SYSCALL(syscall, regs));
4747

arch/x86/entry/syscalls/syscallhdr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
2828

2929
echo ""
3030
echo "#ifdef __KERNEL__"
31-
echo "#define __NR_${prefix}syscall_max $max"
31+
echo "#define __NR_${prefix}syscalls $(($max + 1))"
3232
echo "#endif"
3333
echo ""
3434
echo "#endif /* ${fileguard} */"

arch/x86/include/asm/unistd.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# define __ARCH_WANT_SYS_OLD_MMAP
1414
# define __ARCH_WANT_SYS_OLD_SELECT
1515

16-
# define __NR_ia32_syscall_max __NR_syscall_max
16+
# define IA32_NR_syscalls (__NR_syscalls)
1717

1818
# else
1919

@@ -26,12 +26,12 @@
2626
# define __ARCH_WANT_COMPAT_SYS_PWRITEV64
2727
# define __ARCH_WANT_COMPAT_SYS_PREADV64V2
2828
# define __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
29-
# define X32_NR_syscalls (__NR_x32_syscall_max + 1)
29+
# define X32_NR_syscalls (__NR_x32_syscalls)
30+
# define IA32_NR_syscalls (__NR_ia32_syscalls)
3031

3132
# endif
3233

33-
# define NR_syscalls (__NR_syscall_max + 1)
34-
# define IA32_NR_syscalls (__NR_ia32_syscall_max + 1)
34+
# define NR_syscalls (__NR_syscalls)
3535

3636
# define __ARCH_WANT_NEW_STAT
3737
# define __ARCH_WANT_OLD_READDIR

0 commit comments

Comments
 (0)