[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/47] linux-user: Fix do_shmat type errors
From: |
Richard Henderson |
Subject: |
[PULL 17/47] linux-user: Fix do_shmat type errors |
Date: |
Sat, 15 Jul 2023 14:52:47 +0100 |
The guest address, raddr, should be unsigned, aka abi_ulong.
The host addresses should be cast via *intptr_t not long.
Drop the inline and fix two other whitespace issues.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20230626140250.69572-1-richard.henderson@linaro.org>
---
linux-user/syscall.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c15d9ad743..b78eb686d8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4539,14 +4539,14 @@ static inline abi_ulong target_shmlba(CPUArchState
*cpu_env)
}
#endif
-static inline abi_ulong do_shmat(CPUArchState *cpu_env,
- int shmid, abi_ulong shmaddr, int shmflg)
+static abi_ulong do_shmat(CPUArchState *cpu_env, int shmid,
+ abi_ulong shmaddr, int shmflg)
{
CPUState *cpu = env_cpu(cpu_env);
- abi_long raddr;
+ abi_ulong raddr;
void *host_raddr;
struct shmid_ds shm_info;
- int i,ret;
+ int i, ret;
abi_ulong shmlba;
/* shmat pointers are always untagged */
@@ -4602,9 +4602,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
if (host_raddr == (void *)-1) {
mmap_unlock();
- return get_errno((long)host_raddr);
+ return get_errno((intptr_t)host_raddr);
}
- raddr=h2g((unsigned long)host_raddr);
+ raddr = h2g((uintptr_t)host_raddr);
page_set_flags(raddr, raddr + shm_info.shm_segsz - 1,
PAGE_VALID | PAGE_RESET | PAGE_READ |
@@ -4621,7 +4621,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
mmap_unlock();
return raddr;
-
}
static inline abi_long do_shmdt(abi_ulong shmaddr)
--
2.34.1
- [PULL 15/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2, (continued)
- [PULL 15/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2, Richard Henderson, 2023/07/15
- [PULL 25/47] linux-user: Populate more bits in mmap_flags_tbl, Richard Henderson, 2023/07/15
- [PULL 30/47] linux-user: Widen target_mmap offset argument to off_t, Richard Henderson, 2023/07/15
- [PULL 10/47] linux-user: Use abi_int not int in syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 20/47] linux-user: Make sure initial brk(0) is page-aligned, Richard Henderson, 2023/07/15
- [PULL 36/47] linux-user: Use 'last' instead of 'end' in target_mmap, Richard Henderson, 2023/07/15
- [PULL 17/47] linux-user: Fix do_shmat type errors,
Richard Henderson <=
- [PULL 19/47] tcg: Fix info_in_idx increment in layout_arg_by_ref, Richard Henderson, 2023/07/15
- [PULL 14/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze, Richard Henderson, 2023/07/15
- [PULL 16/47] linux-user/syscall: Implement execve without execveat, Richard Henderson, 2023/07/15
- [PULL 27/47] bsd-user: Use page_check_range_empty for MAP_EXCL, Richard Henderson, 2023/07/15
- [PULL 39/47] linux-user: Simplify target_munmap, Richard Henderson, 2023/07/15
- [PULL 01/47] linux-user: Reformat syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 03/47] linux-user: Use abi_uint not uint32_t in syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 07/47] linux-user: Use abi_uint not unsigned int in syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 11/47] linux-user: Use abi_ushort not unsigned short in syscall_defs.h, Richard Henderson, 2023/07/15
- [PULL 22/47] linux-user/strace: Expand struct flags to hold a mask, Richard Henderson, 2023/07/15