From patchwork Tue Jun 17 14:56:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 32032 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC344206A0 for ; Tue, 17 Jun 2014 14:58:18 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id j107sf118644qga.0 for ; Tue, 17 Jun 2014 07:58:18 -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: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=b7bWqjZ7tSS5bsCtvOfVixrQi60yHGIeh7x17tsjQVQ=; b=MTB+K1xyuYx0M3FdYQ8z2Z0JptY8HoV1oez+nGAEV/kKWSXVvkVgGb2OlqJd2ECZsQ AfEPaaIhTms6pEcw1zHWiC5Qo+fnH4m23byl9n535zO9AeVNZ4eEcfyQ8itXBVPTfuBm JGagHIbVsaz8vOiVsdJVlybFvwbvzk348g4bYc1IpKrga7fs9mzBz34Im8ABSFU390IL SJJMN57e3bDHakxNK6jIkDYQu7pZKcN7YFo1De0QaQWZhc7QYJQGZd7HmEhJk1kmKHCH 5WGqjP9jroBBKStnczvkVCfWKpDbn3ZztFXIa9/BpMZZFWtmhUlvBUFZTAnNwHUBKPml 9ZZQ== X-Gm-Message-State: ALoCoQnaKXs5UleLEw7QrIxnVu8virNuPflQTPB5PZ+Ygs0bEHvfhrWZFbhPEfIcpoQCqQlwMA0Q X-Received: by 10.58.69.78 with SMTP id c14mr710063veu.41.1403017098525; Tue, 17 Jun 2014 07:58:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.145 with SMTP id 17ls4869580qgn.21.gmail; Tue, 17 Jun 2014 07:58:18 -0700 (PDT) X-Received: by 10.220.114.140 with SMTP id e12mr1998880vcq.37.1403017098425; Tue, 17 Jun 2014 07:58:18 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id r4si959391vdp.12.2014.06.17.07.58.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 07:58:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so6421756vcb.7 for ; Tue, 17 Jun 2014 07:58:18 -0700 (PDT) X-Received: by 10.221.7.71 with SMTP id on7mr22293676vcb.18.1403017098314; Tue, 17 Jun 2014 07:58:18 -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 vs6csp215635vcb; Tue, 17 Jun 2014 07:58:17 -0700 (PDT) X-Received: by 10.140.81.16 with SMTP id e16mr13425339qgd.110.1403017097493; Tue, 17 Jun 2014 07:58:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id bj7si16589531qcb.8.2014.06.17.07.58.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Jun 2014 07:58:17 -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]:51133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuq1-0006pO-1k for patch@linaro.org; Tue, 17 Jun 2014 10:58:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuox-0005h0-Hu for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wwuor-0004Os-3g for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:11 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=33138 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuoq-0004OI-Tx for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:05 -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 1F69026517; Tue, 17 Jun 2014 16:57:03 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 17 Jun 2014 17:56:45 +0300 Message-Id: <7df2fa3623dfe8a082bba54ae87750d5030814c1.1403016610.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: peter.maydell@linaro.org, Riku Voipio Subject: [Qemu-devel] [PULL v2 02/17] 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.220.176 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 00a02e1..cf283a8 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 */);