qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
@ 2014-08-02 14:10 Erik de Castro Lopo
  2014-08-02 15:05 ` Peter Maydell
  2014-08-02 23:45 ` [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create Erik de Castro Lopo
  0 siblings, 2 replies; 9+ messages in thread
From: Erik de Castro Lopo @ 2014-08-02 14:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Erik de Castro Lopo

* Add missing unlock of user struct.
* Remove unneeded pointer variable.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
---
 linux-user/syscall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a50229d..7d8f54a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9412,7 +9412,7 @@ 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 sigevent host_sevp = { {0}, };
         struct target_sigevent *ptarget_sevp;
         struct target_timer_t *ptarget_timer;
 
@@ -9432,10 +9432,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo);
                 host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify);
 
-                phost_sevp = &host_sevp;
+                unlock_user_struct(ptarget_sevp, arg2, 0);
             }
 
-            ret = get_errno(timer_create(clkid, phost_sevp, phtimer));
+            ret = get_errno(timer_create(clkid, &host_sevp, phtimer));
             if (ret) {
                 phtimer = NULL;
             } else {
-- 
2.0.1

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

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
  2014-08-02 14:10 [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling Erik de Castro Lopo
@ 2014-08-02 15:05 ` Peter Maydell
  2014-08-02 22:48   ` Erik de Castro Lopo
  2014-08-02 23:45 ` [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create Erik de Castro Lopo
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2014-08-02 15:05 UTC (permalink / raw)
  To: Erik de Castro Lopo; +Cc: Riku Voipio, QEMU Developers

On 2 August 2014 15:10, Erik de Castro Lopo <erikd@mega-nerd.com> wrote:
> * Add missing unlock of user struct.
> * Remove unneeded pointer variable.
>
> Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
> ---
>  linux-user/syscall.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a50229d..7d8f54a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9412,7 +9412,7 @@ 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 sigevent host_sevp = { {0}, };
>          struct target_sigevent *ptarget_sevp;
>          struct target_timer_t *ptarget_timer;
>
> @@ -9432,10 +9432,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>                  host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo);
>                  host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify);
>
> -                phost_sevp = &host_sevp;
> +                unlock_user_struct(ptarget_sevp, arg2, 0);
>              }
>
> -            ret = get_errno(timer_create(clkid, phost_sevp, phtimer));
> +            ret = get_errno(timer_create(clkid, &host_sevp, phtimer));
>              if (ret) {
>                  phtimer = NULL;
>              } else {

Doesn't this turn a timer_create(clkid, NULL, phtimer) into a
timer_create(clkid, something-not-NULL, phtimer) ? That
doesn't seem right to me (and the code you've deleted here
is the common idiom in syscall.c for handling those "arg
is pointer-to-struct-or-NULL" cases).

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
  2014-08-02 15:05 ` Peter Maydell
@ 2014-08-02 22:48   ` Erik de Castro Lopo
  2014-08-02 22:50     ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Erik de Castro Lopo @ 2014-08-02 22:48 UTC (permalink / raw)
  To: qemu-devel

Peter Maydell wrote:

> Doesn't this turn a timer_create(clkid, NULL, phtimer) into a
> timer_create(clkid, something-not-NULL, phtimer) ? That
> doesn't seem right to me (and the code you've deleted here
> is the common idiom in syscall.c for handling those "arg
> is pointer-to-struct-or-NULL" cases).

You're right. Thanks. I will amend this.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

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

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
  2014-08-02 22:48   ` Erik de Castro Lopo
@ 2014-08-02 22:50     ` Peter Maydell
  2014-08-02 23:21       ` Erik de Castro Lopo
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2014-08-02 22:50 UTC (permalink / raw)
  To: QEMU Developers

On 2 August 2014 23:48, Erik de Castro Lopo <mle+tools@mega-nerd.com> wrote:
> Peter Maydell wrote:
>
>> Doesn't this turn a timer_create(clkid, NULL, phtimer) into a
>> timer_create(clkid, something-not-NULL, phtimer) ? That
>> doesn't seem right to me (and the code you've deleted here
>> is the common idiom in syscall.c for handling those "arg
>> is pointer-to-struct-or-NULL" cases).
>
> You're right. Thanks. I will amend this.

Amend it to what? The current code looks fine to me,
so I'm not sure what bug you're trying to fix here.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
  2014-08-02 22:50     ` Peter Maydell
@ 2014-08-02 23:21       ` Erik de Castro Lopo
  2014-08-02 23:30         ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Erik de Castro Lopo @ 2014-08-02 23:21 UTC (permalink / raw)
  To: qemu-devel

Peter Maydell wrote:

> Amend it to what? The current code looks fine to me,
> so I'm not sure what bug you're trying to fix here.

There is still a missing call to unlock_user_struct() inside
the "if (arg2)" block. Is that not worth fixing?

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

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

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
  2014-08-02 23:21       ` Erik de Castro Lopo
@ 2014-08-02 23:30         ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2014-08-02 23:30 UTC (permalink / raw)
  To: QEMU Developers

On 3 August 2014 00:21, Erik de Castro Lopo <mle+tools@mega-nerd.com> wrote:
> Peter Maydell wrote:
>
>> Amend it to what? The current code looks fine to me,
>> so I'm not sure what bug you're trying to fix here.
>
> There is still a missing call to unlock_user_struct() inside
> the "if (arg2)" block. Is that not worth fixing?

Oops, yes; sorry, I missed that part of your commit message.

-- PMM

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

* [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
  2014-08-02 14:10 [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling Erik de Castro Lopo
  2014-08-02 15:05 ` Peter Maydell
@ 2014-08-02 23:45 ` Erik de Castro Lopo
  2014-08-03 13:09   ` Peter Maydell
  2014-08-06  7:47   ` Riku Voipio
  1 sibling, 2 replies; 9+ messages in thread
From: Erik de Castro Lopo @ 2014-08-02 23:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Riku Voipio, Erik de Castro Lopo

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a50229d..5f22b37 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9432,6 +9432,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo);
                 host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify);
 
+                unlock_user_struct(ptarget_sevp, arg2, 0);
                 phost_sevp = &host_sevp;
             }
 
-- 
2.0.1

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

* Re: [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
  2014-08-02 23:45 ` [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create Erik de Castro Lopo
@ 2014-08-03 13:09   ` Peter Maydell
  2014-08-06  7:47   ` Riku Voipio
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2014-08-03 13:09 UTC (permalink / raw)
  To: Erik de Castro Lopo; +Cc: Riku Voipio, QEMU Developers

On 3 August 2014 00:45, Erik de Castro Lopo <erikd@mega-nerd.com> wrote:
> Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
> ---
>  linux-user/syscall.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a50229d..5f22b37 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9432,6 +9432,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>                  host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo);
>                  host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify);
>
> +                unlock_user_struct(ptarget_sevp, arg2, 0);
>                  phost_sevp = &host_sevp;
>              }
>
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
  2014-08-02 23:45 ` [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create Erik de Castro Lopo
  2014-08-03 13:09   ` Peter Maydell
@ 2014-08-06  7:47   ` Riku Voipio
  1 sibling, 0 replies; 9+ messages in thread
From: Riku Voipio @ 2014-08-06  7:47 UTC (permalink / raw)
  To: Erik de Castro Lopo; +Cc: Peter Maydell, Riku Voipio, qemu-devel

On Sun, Aug 03, 2014 at 09:45:38AM +1000, Erik de Castro Lopo wrote:
> Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>

Thanks,

applied to linux-user tree.

> ---
>  linux-user/syscall.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a50229d..5f22b37 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9432,6 +9432,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>                  host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo);
>                  host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify);
>  
> +                unlock_user_struct(ptarget_sevp, arg2, 0);
>                  phost_sevp = &host_sevp;
>              }
>  
> -- 
> 2.0.1
> 

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

end of thread, other threads:[~2014-08-06  7:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-02 14:10 [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling Erik de Castro Lopo
2014-08-02 15:05 ` Peter Maydell
2014-08-02 22:48   ` Erik de Castro Lopo
2014-08-02 22:50     ` Peter Maydell
2014-08-02 23:21       ` Erik de Castro Lopo
2014-08-02 23:30         ` Peter Maydell
2014-08-02 23:45 ` [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create Erik de Castro Lopo
2014-08-03 13:09   ` Peter Maydell
2014-08-06  7:47   ` Riku Voipio

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