From nobody Thu Nov 6 16:20:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542282490674210.56902470233285; Thu, 15 Nov 2018 03:48:10 -0800 (PST) Received: from localhost ([::1]:38275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNG7w-0001JX-MG for importer@patchew.org; Thu, 15 Nov 2018 06:48:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNG6Z-0000fg-CP for qemu-devel@nongnu.org; Thu, 15 Nov 2018 06:46:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNG6X-0005XE-KM for qemu-devel@nongnu.org; Thu, 15 Nov 2018 06:46:38 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:52624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNG6P-0005Q9-FC for qemu-devel@nongnu.org; Thu, 15 Nov 2018 06:46:30 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gNG6F-0001MD-GR; Thu, 15 Nov 2018 11:46:19 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 11:46:16 +0000 Message-Id: <20181115114616.26265-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH for-3.1] linux-user/sparc/signal.c: Remove dead code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Coverity complains (CID 1390847) about some dead code in do_sigreturn(). This is an if (err) clause that can never be true, copied from the kernel (where __get_user returns an error). The one code path that could report an error is in the currently commented-out pseudocode for handling FPU register restoring, so move the if into that comment (and fix the broken indent in the comment in the process). (The new position for the error check is also the semantically correct one -- we should not restore the signal mask from the signal frame if we get an error here, so the check must be done before set_sigmask(), not after.) Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier --- linux-user/sparc/signal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 295e415b1e6..ead169fbaa2 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -282,7 +282,7 @@ long do_sigreturn(CPUSPARCState *env) uint32_t up_psr, pc, npc; target_sigset_t set; sigset_t host_set; - int err=3D0, i; + int i; =20 sf_addr =3D env->regwptr[UREG_FP]; trace_user_do_sigreturn(env, sf_addr); @@ -320,10 +320,13 @@ long do_sigreturn(CPUSPARCState *env) } =20 /* FIXME: implement FPU save/restore: - * __get_user(fpu_save, &sf->fpu_save); - * if (fpu_save) - * err |=3D restore_fpu_state(env, fpu_save); - */ + * __get_user(fpu_save, &sf->fpu_save); + * if (fpu_save) { + * if (restore_fpu_state(env, fpu_save)) { + * goto segv_and_exit; + * } + * } + */ =20 /* This is pretty much atomic, no amount locking would prevent * the races which exist anyways. @@ -336,9 +339,6 @@ long do_sigreturn(CPUSPARCState *env) target_to_host_sigset_internal(&host_set, &set); set_sigmask(&host_set); =20 - if (err) { - goto segv_and_exit; - } unlock_user_struct(sf, sf_addr, 0); return -TARGET_QEMU_ESIGRETURN; =20 --=20 2.19.1