]> www.infradead.org Git - users/dwmw2/linux.git/commit
syscalls: mmap(): use unsigned offset type consistently
authorArnd Bergmann <arnd@arndb.de>
Tue, 4 Jun 2024 12:20:26 +0000 (14:20 +0200)
committerArnd Bergmann <arnd@arndb.de>
Tue, 25 Jun 2024 13:57:38 +0000 (15:57 +0200)
commit295f10061af024099440b46602bcc47364551db7
treed10e0927976e4a9fc727be88fabf80911da88232
parent5daf62da52ecd5761d63cbb6489eb434645547df
syscalls: mmap(): use unsigned offset type consistently

Most architectures that implement the old-style mmap() with byte offset
use 'unsigned long' as the type for that offset, but microblaze and
riscv have the off_t type that is shared with userspace, matching the
prototype in include/asm-generic/syscalls.h.

Make this consistent by using an unsigned argument everywhere. This
changes the behavior slightly, as the argument is shifted to a page
number, and an user input with the top bit set would result in a
negative page offset rather than a large one as we use elsewhere.

For riscv, the 32-bit sys_mmap2() definition actually used a custom
type that is different from the global declaration, but this was
missed due to an incorrect type check.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/csky/kernel/syscall.c
arch/loongarch/kernel/syscall.c
arch/microblaze/kernel/sys_microblaze.c
arch/riscv/kernel/sys_riscv.c
include/asm-generic/syscalls.h