From patchwork Tue Jun 10 13:20:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31648 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DE96820675 for ; Tue, 10 Jun 2014 13:21:56 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf2598431pab.1 for ; Tue, 10 Jun 2014 06:21:56 -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=b7bWqjZ7tSS5bsCtvOfVixrQi60yHGIeh7x17tsjQVQ=; b=fUUYUO+FuxJFeLxRPlHfMkGxdq7gQToaAeEwY7fT8gUxAeWsw2rEv2k4dpc1cFrSmk 3n3Rt9KKEUuZpoZcWRb67nLAllw1kYwiIQwSC/6WSNKoM7eV6bse5rMmFWxlnvz1FSKE 4QVYdaOlfXz0E7gOGYyh9s6+SG4J1wrsEcFKn3lTbANxE7z9vP+i0lfqaJlZnw37bBtT y4y+kaAdUw+xcdAtX2k1R6qEqfKLxqrvVlx7ua+JEM3LHomUz2opgJlgrx1o+RhGcIwf RCylZmmf4zvdG1f1XjK9C6IVwxJs9WYEdkxOkY8m3rgJtmKVo1kVYcfSxXLTbd7xPHjr pCJw== X-Gm-Message-State: ALoCoQnRvvgA4RynM3rwsIYX3A5mnyFdeTM1gHjcKtxVffGs5fuMQCBhowHFsqP8cTe9H9vaYybw X-Received: by 10.66.234.72 with SMTP id uc8mr2435566pac.8.1402406516097; Tue, 10 Jun 2014 06:21:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.46 with SMTP id k43ls2077385qgk.58.gmail; Tue, 10 Jun 2014 06:21:55 -0700 (PDT) X-Received: by 10.52.244.84 with SMTP id xe20mr26721088vdc.3.1402406515808; Tue, 10 Jun 2014 06:21:55 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id de1si13063124vdd.33.2014.06.10.06.21.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 06:21:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id il7so190853vcb.40 for ; Tue, 10 Jun 2014 06:21:55 -0700 (PDT) X-Received: by 10.53.10.234 with SMTP id ed10mr324280vdd.86.1402406515711; Tue, 10 Jun 2014 06:21:55 -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 vs6csp224878vcb; Tue, 10 Jun 2014 06:21:55 -0700 (PDT) X-Received: by 10.224.151.82 with SMTP id b18mr41846056qaw.27.1402406514971; Tue, 10 Jun 2014 06:21:54 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k91si26782781qgd.65.2014.06.10.06.21.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Jun 2014 06:21:54 -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]:39736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuLzu-0001Bw-4J for patch@linaro.org; Tue, 10 Jun 2014 09:21:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuLyu-0000LY-Cm for qemu-devel@nongnu.org; Tue, 10 Jun 2014 09:20:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuLyo-0007Z3-Tc for qemu-devel@nongnu.org; Tue, 10 Jun 2014 09:20:52 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=56209 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuLyo-0007Yo-Li for qemu-devel@nongnu.org; Tue, 10 Jun 2014 09:20: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 1811026517; Tue, 10 Jun 2014 15:20:45 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 10 Jun 2014 16:20:31 +0300 Message-Id: <12fe586e00416ac29d7254bc5cfc4cb0b4b2e2f7.1402405819.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: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Riku Voipio Subject: [Qemu-devel] [PATCH v3 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.220.181 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 */);