From patchwork Mon Jun 9 12:46:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31545 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3DF8820675 for ; Mon, 9 Jun 2014 12:48:05 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id uz6sf6174207obc.8 for ; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=+GxrZaigS9k0kuL1VGJCoXUe3HeTe+DW+fK3nmwlpgc=; b=jmhTjhZpFRTwEftM14xtqaiK+RSMk7pEW5bIZJGj6NrEOXdknxaE/fwTfuWL0hnlGd eTA+hyKgmAPzXNT4rUCIM5LRjYNBMwurXenD95owopMHvprkPojMpp2K5ZQYeOnCu4Tp OZrZ4zFQ58iySy3C1wNtA86vu9IBLaeKmRFGH4ValNzjguXmrMZOsfhf+tW6IOWZ6ORO AepJj6L4XcYd0GAc+GyjwxmzM1aOAqpOtpJmICTpANjbWWHWp8HW1Fi5fr5J/Q+e+vHJ xblLKyscSXTCPNYcyDElSDnB0og4sa9vZYBdITgJJn6oVYBsozOdlynJcb+YnwZxQ74o r2yQ== X-Gm-Message-State: ALoCoQkC1YMDIyC2zQz86YUI03lY8FUsM06Gu7nSs381Bj+wRZyLU+Dq19/UmI3b2T78+/WhbXz7 X-Received: by 10.182.128.234 with SMTP id nr10mr1201701obb.0.1402318084540; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.229 with SMTP id j92ls1565960qgf.14.gmail; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) X-Received: by 10.52.138.232 with SMTP id qt8mr21571725vdb.44.1402318084401; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id hf4si11794325vdb.99.2014.06.09.05.48.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:48:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so3521495veb.11 for ; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr168363vcf.71.1402318084340; Mon, 09 Jun 2014 05:48:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp143293vcb; Mon, 9 Jun 2014 05:48:04 -0700 (PDT) X-Received: by 10.224.160.202 with SMTP id o10mr32820295qax.8.1402318083583; Mon, 09 Jun 2014 05:48:03 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w95si22888947qgd.87.2014.06.09.05.48.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtyzb-0006fN-67 for patch@linaro.org; Mon, 09 Jun 2014 08:48:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyT-0005cI-0g for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtyyM-0007gi-Ll for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:52 -0400 Received: from afflict.kos.to ([92.243.29.197]:40141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyM-0007fx-Eh for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:46 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 735DF26517; Mon, 9 Jun 2014 14:46:44 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 9 Jun 2014 15:46:27 +0300 Message-Id: <3962a2bd845203d902fad1b53973d33ed0d615cd.1402317549.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Riku Voipio Subject: [Qemu-devel] [PULL 02/18] signal/x86/setup_frame: __put_user cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Riku Voipio Remove the remaining check for __put_user return value, and all the checks for err variable which isn't set anywhere anymore. No we can only end up in give_sigsegv due to failed lock_user_struct - thus we remove the unlock_user_struct to avoid unlocking a region never locked. Signed-off-by: Riku Voipio Reviewed-by: Peter Maydell --- linux-user/signal.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 22346e4..ed2f50f 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -911,7 +911,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, { abi_ulong frame_addr; struct sigframe *frame; - int i, err = 0; + int i; frame_addr = get_sigframe(ka, env, sizeof(*frame)); @@ -920,18 +920,13 @@ static void setup_frame(int sig, struct target_sigaction *ka, __put_user(current_exec_domain_sig(sig), &frame->sig); - if (err) - goto give_sigsegv; setup_sigcontext(&frame->sc, &frame->fpstate, env, set->sig[0], frame_addr + offsetof(struct sigframe, fpstate)); - if (err) - goto give_sigsegv; - for(i = 1; i < TARGET_NSIG_WORDS; i++) { - if (__put_user(set->sig[i], &frame->extramask[i - 1])) - goto give_sigsegv; - } + for(i = 1; i < TARGET_NSIG_WORDS; i++) { + __put_user(set->sig[i], &frame->extramask[i - 1]); + } /* Set up to return from userspace. If provided, use a stub already in userspace. */ @@ -950,8 +945,6 @@ static void setup_frame(int sig, struct target_sigaction *ka, __put_user(val16, (uint16_t *)(frame->retcode+6)); } - if (err) - goto give_sigsegv; /* Set up registers for signal handler */ env->regs[R_ESP] = frame_addr; @@ -968,7 +961,6 @@ static void setup_frame(int sig, struct target_sigaction *ka, return; give_sigsegv: - unlock_user_struct(frame, frame_addr, 1); if (sig == TARGET_SIGSEGV) ka->_sa_handler = TARGET_SIG_DFL; force_sig(TARGET_SIGSEGV /* , current */);