From patchwork Thu Nov 15 11:46:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 151223 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6888577ljp; Thu, 15 Nov 2018 03:46:21 -0800 (PST) X-Google-Smtp-Source: AJdET5cLKH6XwQrtVDdtWQloo/+ApeE6iNYlCpkYkWa2B1IozrRcqEVuQNVNN09P20WbZMr0XEBT X-Received: by 2002:a1c:741a:: with SMTP id p26-v6mr5096858wmc.125.1542282381133; Thu, 15 Nov 2018 03:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542282381; cv=none; d=google.com; s=arc-20160816; b=UAKuyBe7T/sPhMoCXmVjDEhbnRrcVL5DJ95X/JYiCHmbHavLIzESFskm+IA5JCHc3y JpeeLUGHJlB5t5+5cm5yxPbD+W2T29THBBZgQGLhtFfKl7npYt7KoizKKDgAoYN+89b9 Ydov+HavCp904DThOzEVk5zkizNI3FSCNwCeeVA5xcstvVExQ+YFl6OzN2MrUTyYwC4T A89GrX/BCajZVKy98zdZlCgjHax4YxifxRe/VTFClYdj+smRjSAr1Ar7rOt65KY/ujuh +Ik/O/a1dirwBqhilFl3d8h7icJ0Fj55Z6wl5cmOwAjuHRKNQ9KRjODoulyIdjKVSTgc 48pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=J/5rDDQtFcRLzDgIlh3OR249UsUs55tUfl43S0ntoNU=; b=KpPP5BshPwaiifmZe2kgheSI9MN/Gq4GnoEbTtDiQCrxucImmSDl2C1eBa33i4ThSd 73r4Yf10zla1XeTRRORYJ5F+ckmnYMipI7pDnEviJgVRXBudJayQ125jRiz1+dj2b417 7CmZRQ8z5pbzInw8nEbS8Jr20u4BqzUWmaLzGNHfbyjMH/YfSU7NX6p9bX+CXWk33y+3 vjrmRjpEg2n299Q2fmri64SPvxHiy8tAz4mHjskSIhcthLG1D42Jhna2dsPevznebDBa mkjnwkzpRnVhEggRWxP2BIaxIKvE9dpI/DwGQB5U5TCwk02ggPdssMcrx9Jne/Taweh1 MojA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id w5-v6si4706213wrs.346.2018.11.15.03.46.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 03:46:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 Cc: patches@linaro.org, Riku Voipio , Laurent Vivier Subject: [PATCH for-3.1] linux-user/sparc/signal.c: Remove dead code 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 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 --- linux-user/sparc/signal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.19.1 Reviewed-by: Laurent Vivier 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=0, i; + int i; sf_addr = env->regwptr[UREG_FP]; trace_user_do_sigreturn(env, sf_addr); @@ -320,10 +320,13 @@ long do_sigreturn(CPUSPARCState *env) } /* FIXME: implement FPU save/restore: - * __get_user(fpu_save, &sf->fpu_save); - * if (fpu_save) - * err |= 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; + * } + * } + */ /* 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); - if (err) { - goto segv_and_exit; - } unlock_user_struct(sf, sf_addr, 0); return -TARGET_QEMU_ESIGRETURN;