Patchwork linux-user: change do_semop to return target errno when unsuccessful

login
register
mail settings
Submitter Petar Jovanovic
Date March 21, 2013, 5:57 p.m.
Message ID <1363888656-123910-1-git-send-email-petar.jovanovic@rt-rk.com>
Download mbox | patch
Permalink /patch/229787/
State New
Headers show

Comments

Petar Jovanovic - March 21, 2013, 5:57 p.m.
From: Petar Jovanovic <petar.jovanovic@imgtec.com>

do_semop() is called from two places, and one of these fails to convert
return error to target errno when semop fails. This patch changes the
function to always return target errno in case of an unsuccessful call.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
---
 linux-user/syscall.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Peter Maydell - March 21, 2013, 6:03 p.m.
On 21 March 2013 17:57, Petar Jovanovic <petar.jovanovic@rt-rk.com> wrote:
> From: Petar Jovanovic <petar.jovanovic@imgtec.com>
>
> do_semop() is called from two places, and one of these fails to convert
> return error to target errno when semop fails. This patch changes the
> function to always return target errno in case of an unsuccessful call.
>
> Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>

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

-- PMM
Petar Jovanovic - April 1, 2013, 5:07 p.m.
ping

http://patchwork.ozlabs.org/patch/229787/
Petar Jovanovic - April 8, 2013, 6:31 p.m.
ping
Petar Jovanovic - April 15, 2013, 12:10 p.m.
+ qemu-trivial@nongnu.org

ping
Stefan Hajnoczi - April 19, 2013, 9:42 a.m.
On Thu, Mar 21, 2013 at 06:57:36PM +0100, Petar Jovanovic wrote:
> From: Petar Jovanovic <petar.jovanovic@imgtec.com>
> 
> do_semop() is called from two places, and one of these fails to convert
> return error to target errno when semop fails. This patch changes the
> function to always return target errno in case of an unsuccessful call.
> 
> Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
> ---
>  linux-user/syscall.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan
riku.voipio@linaro.org - April 19, 2013, 10:10 a.m.
On 19 April 2013 12:42, Stefan Hajnoczi <stefanha@gmail.com> wrote:

> On Thu, Mar 21, 2013 at 06:57:36PM +0100, Petar Jovanovic wrote:
> > From: Petar Jovanovic <petar.jovanovic@imgtec.com>
> >
> > do_semop() is called from two places, and one of these fails to convert
> > return error to target errno when semop fails. This patch changes the
> > function to always return target errno in case of an unsuccessful call.
> >
> > Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
> > ---
> >  linux-user/syscall.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks, applied to the trivial patches tree:
> https://github.com/stefanha/qemu/commits/trivial-patches
>
> Hi,

It's also in my linux-user updates set I'm testing now:

https://git.linaro.org/gitweb?p=people/rikuvoipio/qemu.git;a=shortlog;h=refs/heads/linux-user-for-upstream

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ee82a2d..3c4c155 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2764,7 +2764,7 @@  static inline abi_long do_semop(int semid, abi_long ptr, unsigned nsops)
     if (target_to_host_sembuf(sops, ptr, nsops))
         return -TARGET_EFAULT;
 
-    return semop(semid, sops, nsops);
+    return get_errno(semop(semid, sops, nsops));
 }
 
 struct target_msqid_ds
@@ -6957,7 +6957,7 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #ifdef TARGET_NR_semop
     case TARGET_NR_semop:
-        ret = get_errno(do_semop(arg1, arg2, arg3));
+        ret = do_semop(arg1, arg2, arg3);
         break;
 #endif
 #ifdef TARGET_NR_semctl