qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: fix layout of struct target_msq_id_ds
@ 2025-10-09 12:56 Andreas Schwab
  2025-10-09 13:55 ` Philippe Mathieu-Daudé
  2025-10-09 15:42 ` Richard Henderson
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Schwab @ 2025-10-09 12:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel

The msg_lspid and msg_lrpid members are of type pid_t, which is a 32-bit
integer.

Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 linux-user/syscall.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0956a7b310..3dcdb3ef42 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4185,8 +4185,8 @@ struct target_msqid_ds
     abi_ulong __msg_cbytes;
     abi_ulong msg_qnum;
     abi_ulong msg_qbytes;
-    abi_ulong msg_lspid;
-    abi_ulong msg_lrpid;
+    unsigned int msg_lspid;
+    unsigned int msg_lrpid;
     abi_ulong __unused4;
     abi_ulong __unused5;
 };
@@ -4206,8 +4206,8 @@ static inline abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,
     host_md->__msg_cbytes = tswapal(target_md->__msg_cbytes);
     host_md->msg_qnum = tswapal(target_md->msg_qnum);
     host_md->msg_qbytes = tswapal(target_md->msg_qbytes);
-    host_md->msg_lspid = tswapal(target_md->msg_lspid);
-    host_md->msg_lrpid = tswapal(target_md->msg_lrpid);
+    host_md->msg_lspid = tswap32(target_md->msg_lspid);
+    host_md->msg_lrpid = tswap32(target_md->msg_lrpid);
     unlock_user_struct(target_md, target_addr, 0);
     return 0;
 }
@@ -4227,8 +4227,8 @@ static inline abi_long host_to_target_msqid_ds(abi_ulong target_addr,
     target_md->__msg_cbytes = tswapal(host_md->__msg_cbytes);
     target_md->msg_qnum = tswapal(host_md->msg_qnum);
     target_md->msg_qbytes = tswapal(host_md->msg_qbytes);
-    target_md->msg_lspid = tswapal(host_md->msg_lspid);
-    target_md->msg_lrpid = tswapal(host_md->msg_lrpid);
+    target_md->msg_lspid = tswap32(host_md->msg_lspid);
+    target_md->msg_lrpid = tswap32(host_md->msg_lrpid);
     unlock_user_struct(target_md, target_addr, 1);
     return 0;
 }
-- 
2.51.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-09 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 12:56 [PATCH] linux-user: fix layout of struct target_msq_id_ds Andreas Schwab
2025-10-09 13:55 ` Philippe Mathieu-Daudé
2025-10-09 14:12   ` Andreas Schwab
2025-10-09 15:42 ` Richard Henderson
2025-10-09 15:46   ` Richard Henderson

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).