qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>,
	Laurent Vivier <laurent@vivier.eu>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 1/4] linux-user: Remove dead error-checking code
Date: Mon, 12 Nov 2018 21:49:26 +0100	[thread overview]
Message-ID: <20181112204929.12625-2-laurent@vivier.eu> (raw)
In-Reply-To: <20181112204929.12625-1-laurent@vivier.eu>

From: Peter Maydell <peter.maydell@linaro.org>

Remove some dead code spotted by Coverity (CID 1009855,
1390854, 1390847). The underlying cause in all these cases
is the same: QEMU's put_user operations can't result in
errors, but the kernel's equivalent does. So when code
was copied from the kernel signal-frame-setup/teardown
code, checks on error flags that were needed in the kernel
became dead code for us.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20181019161715.12122-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/m68k/signal.c  | 3 ---
 linux-user/sh4/signal.c   | 4 ----
 linux-user/sparc/signal.c | 2 --
 3 files changed, 9 deletions(-)

diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c
index 38bd77ec16..49ff87c77b 100644
--- a/linux-user/m68k/signal.c
+++ b/linux-user/m68k/signal.c
@@ -334,9 +334,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
                (uint32_t *)(frame->retcode + 0));
     __put_user(0x4e40, (uint16_t *)(frame->retcode + 4));
 
-    if (err)
-        goto give_sigsegv;
-
     /* Set up to return from userspace */
 
     env->aregs[7] = frame_addr;
diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c
index c6752baa7e..cc89a48ff8 100644
--- a/linux-user/sh4/signal.c
+++ b/linux-user/sh4/signal.c
@@ -279,7 +279,6 @@ long do_sigreturn(CPUSH4State *regs)
     sigset_t blocked;
     target_sigset_t target_set;
     int i;
-    int err = 0;
 
     frame_addr = regs->gregs[15];
     trace_user_do_sigreturn(regs, frame_addr);
@@ -292,9 +291,6 @@ long do_sigreturn(CPUSH4State *regs)
         __get_user(target_set.sig[i], &frame->extramask[i - 1]);
     }
 
-    if (err)
-        goto badframe;
-
     target_to_host_sigset_internal(&blocked, &target_set);
     set_sigmask(&blocked);
 
diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c
index e44e99993c..295e415b1e 100644
--- a/linux-user/sparc/signal.c
+++ b/linux-user/sparc/signal.c
@@ -256,8 +256,6 @@ void setup_frame(int sig, struct target_sigaction *ka,
         /* t 0x10 */
         val32 = 0x91d02010;
         __put_user(val32, &sf->insns[1]);
-        if (err)
-            goto sigsegv;
     }
     unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
     return;
-- 
2.17.2

  reply	other threads:[~2018-11-12 20:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 20:49 [Qemu-devel] [PULL 0/4] Linux user for 3.1 patches Laurent Vivier
2018-11-12 20:49 ` Laurent Vivier [this message]
2018-11-12 20:49 ` [Qemu-devel] [PULL 2/4] linux-user: Don't call gdb_handlesig() before queue_signal() Laurent Vivier
2018-11-12 20:49 ` [Qemu-devel] [PULL 3/4] linux-user: Clean up nios2 main loop signal handling Laurent Vivier
2018-11-12 20:49 ` [Qemu-devel] [PULL 4/4] linux-user: Add support for SO_REUSEPORT Laurent Vivier
2018-11-13 12:32 ` [Qemu-devel] [PULL 0/4] Linux user for 3.1 patches 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=20181112204929.12625-2-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).