From patchwork Wed Apr 23 13:11:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 28881 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C6B3120534 for ; Wed, 23 Apr 2014 13:13:15 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id m5sf2872717qaj.5 for ; Wed, 23 Apr 2014 06:13:15 -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: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=Rfe+IpdV74O/KgH8vUCO3JkUVBenuEOp0Y2dYbrZySY=; b=WyUkPYbPRLIEWP7orRtf60HLVqQVLNLTbF0qJPLUaWA/Jd5DZxNHERC9h5KgIM+wWX uACPE7xUTtYW7kM2FbcXOu9Pjnx4t14Oi2sYWdvBuXLAIDFqkQRNQGsdhL0g7o6Jlf/K FybGIDIHXhj/n7jkXnAhkNlPGBILz38BipkGQ5PSBTvfJmQ2aCHrfhxvArp94NTbb6F5 5NBVvHJQ/EzeD/fLqWPwJofXlS4nWzPP+XiN3OnfwBNQjlVcwynd3TDXKwTqc0xDSEx2 C332Ltq/3CIbeJIOVh6Qv5WgHDLKKGu4Vl+ZE64Nf/WDJNQiKaCwSXcTJPGIMUi5GgM2 lCXA== X-Gm-Message-State: ALoCoQlMayZbFIrT88++OLZT/YZ+5dtO6x0QJa1JhyasEvcCPgz4oRRL5n5GmCiVp2s9d+FkPXcr X-Received: by 10.58.178.81 with SMTP id cw17mr24119875vec.37.1398258795287; Wed, 23 Apr 2014 06:13:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.36 with SMTP id y33ls574745qgd.82.gmail; Wed, 23 Apr 2014 06:13:15 -0700 (PDT) X-Received: by 10.52.113.1 with SMTP id iu1mr1164892vdb.35.1398258795143; Wed, 23 Apr 2014 06:13:15 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id a19si157957vcq.94.2014.04.23.06.13.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:13:15 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hr9so1114602vcb.15 for ; Wed, 23 Apr 2014 06:13:15 -0700 (PDT) X-Received: by 10.53.1.69 with SMTP id be5mr12030230vdd.27.1398258795081; Wed, 23 Apr 2014 06:13:15 -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.220.221.72 with SMTP id ib8csp102945vcb; Wed, 23 Apr 2014 06:13:13 -0700 (PDT) X-Received: by 10.140.23.7 with SMTP id 7mr9304794qgo.0.1398258793672; Wed, 23 Apr 2014 06:13:13 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d5si429765qab.15.2014.04.23.06.13.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:13:13 -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]:60835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcwzB-0002oo-3q for patch@linaro.org; Wed, 23 Apr 2014 09:13:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcwyE-0001ki-5T for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wcwy7-0001IM-Q7 for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:14 -0400 Received: from afflict.kos.to ([92.243.29.197]:42795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wcwy7-0001I2-Io for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:07 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id C13DF264D0 for ; Wed, 23 Apr 2014 15:12:05 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 23 Apr 2014 16:11:53 +0300 Message-Id: <6460893085b5923b884c7aa916e8d4de3795659d.1398257165.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Subject: [Qemu-devel] [PATCH 02/13] signal.c setup_frame/x86: __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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 is no longer set anywhere. Now 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 4155cac..f261383 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 */);