* [PATCH] linux-user: Fix do_shmat type errors
@ 2023-06-26 14:02 Richard Henderson
2023-06-26 15:06 ` Anton Johansson via
2023-06-28 6:47 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2023-06-26 14:02 UTC (permalink / raw)
To: qemu-devel; +Cc: anjo, laurent
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>
---
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 f2cb101d83..59b530547a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4528,14 +4528,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 */
@@ -4591,9 +4591,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 |
@@ -4610,7 +4610,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Fix do_shmat type errors
2023-06-26 14:02 [PATCH] linux-user: Fix do_shmat type errors Richard Henderson
@ 2023-06-26 15:06 ` Anton Johansson via
2023-06-28 6:47 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Anton Johansson via @ 2023-06-26 15:06 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: laurent
On 6/26/23 16:02, Richard Henderson wrote:
> 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>
> ---
> linux-user/syscall.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
Reviewed-by: Anton Johansson <anjo@rev.ng>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Fix do_shmat type errors
2023-06-26 14:02 [PATCH] linux-user: Fix do_shmat type errors Richard Henderson
2023-06-26 15:06 ` Anton Johansson via
@ 2023-06-28 6:47 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-28 6:47 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: anjo, laurent
On 26/6/23 16:02, Richard Henderson wrote:
> 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>
> ---
> linux-user/syscall.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-28 6:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26 14:02 [PATCH] linux-user: Fix do_shmat type errors Richard Henderson
2023-06-26 15:06 ` Anton Johansson via
2023-06-28 6:47 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).