linux-user/syscall.c : Minor cleanups of timer_create handling.
PATCH 1/1 linux-user/syscall.c : Minor cleanups of timer_create handling.
* Add missing unlock of user struct.
* Remove unneeded pointer variable.
--- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall.c +3 -3
@@ -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 {
Signature · 1 line
2.0.1
Quoted 24 lines · Erik de Castro Lopo
* Add missing unlock of user struct.
* Remove unneeded pointer variable.Signed-off-by Erik de Castro Lopo <[email protected]>--- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)linux-user/syscall.c +1
-1@@ -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);
linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 9441
Quoted 10 lines
linux-user/syscall.c +2
-2- 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
Quoted 5 lines · Peter Maydell
Doesn't this turn a
timer_create(clkid, NULL, phtimer)into atimer_create(clkid, something-not-NULL, phtimer)? That doesn't seem right to me (and the code you've deleted here is the common idiom insyscall.cfor handling those "arg is pointer-to-struct-or-NULL" cases).
You're right. Thanks. I will amend this.
Erik
Signature · 3 lines
---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Quoted 9 lines · Erik de Castro Lopo
Quoted 5 lines · Peter Maydell
Doesn't this turn a
timer_create(clkid, NULL, phtimer)into atimer_create(clkid, something-not-NULL, phtimer)? That doesn't seem right to me (and the code you've deleted here is the common idiom insyscall.cfor 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
Quoted 2 lines · Peter Maydell
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
Signature · 3 lines
---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Quoted 7 lines · Erik de Castro Lopo
Quoted 2 lines · Peter Maydell
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
PATCH 1/1 linux-user: Add missing unlock_user_struct to timer_create.
In reply to Erik de Castro Lopo--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
@@ -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; }
Signature · 1 line
2.0.1
Re: [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
Quoted 10 lines · Erik de Castro Lopo
Signed-off-by Erik de Castro Lopo <[email protected]>--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)linux-user/syscall.c +0
-0
linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
Quoted 8 lines
linux-user/syscall.c +1
-1@@ -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; } --
thanks
-- PMM
Riku Voipio
AppliedRe: [Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
In reply to Erik de Castro LopoQuoted 1 line · Erik de Castro Lopo
Signed-off-by Erik de Castro Lopo <[email protected]>
Thanks,
applied to linux-user tree.
Quoted 19 lines
--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)linux-user/syscall.c +1
-0@@ -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; }Signature · 1 line
2.0.1