Skip to content

Commit

Permalink
Set size of syscall table to SYS_max
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Dec 18, 2024
1 parent 9b0c04d commit 2fbe93b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions liblfix/arch/amd64/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ sysunlink(LFIXProc* p, uintptr_t pathp)
}
SYSWRAP_1(sysunlink, uintptr_t);

SyscallFn syscalls[] = {
SyscallFn syscalls[SYS_max] = {
[LSYS_read] = sysread_,
[LSYS_write] = syswrite_,
[LSYS_readv] = sysreadv_,
Expand Down Expand Up @@ -169,4 +169,4 @@ SyscallFn syscalls[] = {
[LSYS_sigaltstack] = sysignore_,
};

_Static_assert(sizeof(syscalls) / sizeof(SyscallFn) < SYS_max, "syscalls exceed SYS_max");
_Static_assert(sizeof(syscalls) / sizeof(SyscallFn) <= SYS_max, "syscalls exceed SYS_max");
4 changes: 2 additions & 2 deletions liblfix/arch/arm64/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum {
LSYS_ftruncate = 46,
};

SyscallFn syscalls[] = {
SyscallFn syscalls[SYS_max] = {
[LSYS_read] = sysread_,
[LSYS_write] = syswrite_,
[LSYS_readv] = sysreadv_,
Expand Down Expand Up @@ -109,4 +109,4 @@ SyscallFn syscalls[] = {
[LSYS_ftruncate] = sysignore_,
};

_Static_assert(sizeof(syscalls) / sizeof(SyscallFn) < SYS_max, "syscalls exceed SYS_max");
_Static_assert(sizeof(syscalls) / sizeof(SyscallFn) <= SYS_max, "syscalls exceed SYS_max");

0 comments on commit 2fbe93b

Please sign in to comment.