From patchwork Fri Jun 6 09:46:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31472 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5337D203C3 for ; Fri, 6 Jun 2014 09:53:30 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id g18sf11307337oah.1 for ; Fri, 06 Jun 2014 02:53:30 -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: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=TKdMTOOY9orYXl/TtXE+r0omPIsPuZpL4mHnAbxlLBM=; b=k6T0nB1TkL2wJikgGKBUp+8KSvfx5iesvSb3s5huYAGl44mYMdQlnwNIhxe99oZy6L GWUzXSkyT/09ztK1Xd3IBxq9XUwFw+2GBhaSMybI+4rjvR0oqSzjZx/DkAwevluJmnWz EWN2+X7Ik0QNTM3eQKhYMXkWmkh/xB2WQ82xKnUEWkiH09t8yvga8yRx81v9ntYa1A0M SmAqIyRYg5j4a5zPF1tk9uyx2PWnF9S+HPABUWGNmSi35qJsK4HW2PnyB0PnCS7fuxbp 6YEV9FErNnnifHOlWc5kOf0oQomVUadEANTh/+/3UGG/z1DEtJT0aSo1eaJXkD4/xzw6 oyuw== X-Gm-Message-State: ALoCoQnCq0s2bXb/OJmjWN3HwJCrw3qnoOnG9rcGvuSYr45orAspLhtxfJG7Q9XLhItojDhI0hsE X-Received: by 10.43.92.195 with SMTP id br3mr2321721icc.1.1402048410262; Fri, 06 Jun 2014 02:53:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.173 with SMTP id 42ls629403qgh.27.gmail; Fri, 06 Jun 2014 02:53:30 -0700 (PDT) X-Received: by 10.52.4.40 with SMTP id h8mr293319vdh.95.1402048410079; Fri, 06 Jun 2014 02:53:30 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id lx4si5755103veb.29.2014.06.06.02.53.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 02:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so2784335veb.2 for ; Fri, 06 Jun 2014 02:53:30 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr1532532vca.45.1402048410007; Fri, 06 Jun 2014 02:53:30 -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 vs6csp84504vcb; Fri, 6 Jun 2014 02:53:29 -0700 (PDT) X-Received: by 10.224.171.195 with SMTP id i3mr6743368qaz.44.1402048409539; Fri, 06 Jun 2014 02:53:29 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s105si12011080qgd.19.2014.06.06.02.53.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 06 Jun 2014 02:53:29 -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]:46233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsqq1-0007sm-6l for patch@linaro.org; Fri, 06 Jun 2014 05:53:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsqju-0006Fu-Bg for qemu-devel@nongnu.org; Fri, 06 Jun 2014 05:47:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wsqjl-0001W6-Ls for qemu-devel@nongnu.org; Fri, 06 Jun 2014 05:47:10 -0400 Received: from afflict.kos.to ([92.243.29.197]:38355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsqjl-0001UZ-F2 for qemu-devel@nongnu.org; Fri, 06 Jun 2014 05:47:01 -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 6573926516; Fri, 6 Jun 2014 11:46:59 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 6 Jun 2014 12:46:46 +0300 Message-Id: <1402048017-30604-3-git-send-email-riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Riku Voipio Subject: [Qemu-devel] [PATCH v2 02/13] 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.171 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 --- 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 */);