qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: tommusta@gmail.com, riku.voipio@iki.fi, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 2.2 v2 1/3] linux-user: Fix timer_create timer id return type
Date: Mon, 10 Nov 2014 18:44:20 +0100	[thread overview]
Message-ID: <1415641462-52468-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1415641462-52468-1-git-send-email-agraf@suse.de>

The linux syscall to create_timer really gets an s32* parameter to store
its timer id into, not an abi_ulong*. Remove the useless struct encapsulation
and directly write the 32bit value into memory.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 linux-user/syscall.c      | 5 +----
 linux-user/syscall_defs.h | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a175cc1..d012c71 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9579,7 +9579,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         /* args: clockid_t clockid, struct sigevent *sevp, timer_t *timerid */
 
         struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL;
-        struct target_timer_t *ptarget_timer;
 
         int clkid = arg1;
         int timer_index = next_free_host_timer();
@@ -9601,11 +9600,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             if (ret) {
                 phtimer = NULL;
             } else {
-                if (!lock_user_struct(VERIFY_WRITE, ptarget_timer, arg3, 1)) {
+                if (put_user(0xcafe0000 | timer_index, arg3, target_timer_t)) {
                     goto efault;
                 }
-                ptarget_timer->ptr = tswap32(0xcafe0000 | timer_index);
-                unlock_user_struct(ptarget_timer, arg3, 1);
             }
         }
         break;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c9e6323..ebb3be1 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2564,10 +2564,7 @@ struct target_ucred {
 
 #endif
 
-
-struct target_timer_t {
-    abi_ulong ptr;
-};
+typedef int32_t target_timer_t;
 
 #define TARGET_SIGEV_MAX_SIZE 64
 
-- 
1.7.12.4

  reply	other threads:[~2014-11-10 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 17:44 [Qemu-devel] [PATCH 2.2 v2 0/3] linux-user: Fix posix timer implementation Alexander Graf
2014-11-10 17:44 ` Alexander Graf [this message]
2014-11-10 17:55   ` [Qemu-devel] [PATCH 2.2 v2 1/3] linux-user: Fix timer_create timer id return type Peter Maydell
2014-11-10 17:44 ` [Qemu-devel] [PATCH 2.2 v2 2/3] linux-user: Properly handle timer magic offset Alexander Graf
2014-11-10 17:44 ` [Qemu-devel] [PATCH 2.2 v2 3/3] linux-user: Use target_timer_t type for timer parameters Alexander Graf
2014-11-10 17:57   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415641462-52468-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=tommusta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).