From patchwork Wed Apr 28 19:34:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 428620 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp934263jao; Wed, 28 Apr 2021 12:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF2yNtmdaCCuSI/9f1bFsndBBnv1l0ZmjbnfLUMjWtGiWujzKYzBdRplZwkKvTsg2qoBX1 X-Received: by 2002:a37:a34b:: with SMTP id m72mr29151652qke.92.1619639537488; Wed, 28 Apr 2021 12:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619639537; cv=none; d=google.com; s=arc-20160816; b=Zj4jQjdcbAOSct0qS0h/uEIpEDGAJ7Pn/NquPzxReI5NxMptG7EqUZ2E4jAfBtU7Ex /0xqT099BQQz/74YTJhinIA/bVFNmnxktYxvKXueRlslq/1wq9pcI0Df0jIxFbU1wvbU zpuoii+yOIE0/pk1Oa+LCtdtsK1e2wK90SF6voYqIAXu6iLv18A7lWyFy6Q7SfAmyx8F kkr87wm49NZBtKoat46LdF4TH6ENl/f/dIOL5gBBr7uDPEEqI7/HN4jlssy97Ko6YQT/ W0mWHP/CpCKLPyxEcRU1+Ij55RUXIfwuJtfnSFWU0UH9Asy14tUK29/c9Jk2JykRJVEF LcyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=f8MdWoDokEF0cHPZFw2bFHzROtZRzCCUjyEwgPtySPNegMjSAt41p+rcCjhlpVinZx ryjbZhzEFzmI1tGfembueSePVCwqFtCGXlXlM8wHXM9opdKT3G761846HaoxwPNRDQ4q jWEFyq8qmNzoLvF2r7UUcNwf2kIQavow+XP0NADyR10cU+YaQ4m11J/D64NFWWFJVxBL UFuXEiphL2A9fLqFTwN9wx1HEyjPlZLbMJNIaaitpR1+2uV/wy50r0XIIsq+YiROBB0w 7xLnKzFD/KKaWbdmbtV2+57JNS3p/8r8ae5oEoY1yhPuASy23+rFpwTCiX002wsp0TPo MwNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x8IjsIad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b13si454572qka.42.2021.04.28.12.52.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Apr 2021 12:52:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x8IjsIad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbqEK-0006F5-TC for patch@linaro.org; Wed, 28 Apr 2021 15:52:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbpx6-0005z4-Lk for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:28 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:35736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbpwu-0004er-FX for qemu-devel@nongnu.org; Wed, 28 Apr 2021 15:34:26 -0400 Received: by mail-pf1-x42e.google.com with SMTP id c19so8558643pfv.2 for ; Wed, 28 Apr 2021 12:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=x8IjsIadr9yYK6/prYuf35p2vPokhrmWwGPNYB2/VDm/BlbQsWB6h4eNF0TX5+HseH E06j3RQza/32oneAlOX7gE7IC1hTMDHfoa7DcdgRl/Oe0VmVIuWA6/YmEi+N2QUPd84R VTeG0K0q8sJVhCbepSt4tNnwlZ9jdprAl1NK4eFfPfc/ZpCJDJ/X3gIh36O13ABH1GkD ltMTp8MPiHv9H0eEhE1nAxdlRzfDlWbLh0R3BMGSrMk4JTGLw5jyNgmcnMTWRpN3WOos T7LLouCFpC/8Y5HAuheJS1RunDQ6UWw3cJOVYy47D7hbleGPWOaZYyGXJbYvTniDZmWs MSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QsjGwtPl+BBfkIl5lrH7yu7GOPcN5GtbMrNa8PNGqig=; b=kbfDDuz3D3mx1Sv9UCPZIRS4CfCNDGD++ksWElqLvMHcZlEFejzOzozsdePYK/3qA0 3y+VsGDs3Pdo+d0sLyQk/km6sOIGUJWVPDYNo42Ki1wNIAWgHEdVYFTffdSPFvGiMaox QcBHNq8LRfD8ArCftcNxC5BxikiytPVu6YmSdCfEUk3Bi3tz3I70xmtLAzjOK+gnw/yJ elOBxYhEA/fIiO/uEZhxnEpycjNptd5fLpXpHvV4n2M2DHmQRydDnHu7RT0V05PGTjq9 MwtBnPV9f7n38UAxOB7Q5AeTkARHsJRP+2eBusnm2mRTnfdg82fVLsejkKndJHBS2aZh kH1A== X-Gm-Message-State: AOAM530JcwSKHT2mh4+575bV5lqAUu6I3VdR7WSMWngyqTMK5Ev3i85U PodYdFaXUt29qJJgZclDllcxX8CXa9B1gA== X-Received: by 2002:a63:ff09:: with SMTP id k9mr7500501pgi.35.1619638455178; Wed, 28 Apr 2021 12:34:15 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id h21sm403725pfo.211.2021.04.28.12.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 12:34:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/15] linux-user/s390x: Clean up single-use gotos in signal.c Date: Wed, 28 Apr 2021 12:34:02 -0700 Message-Id: <20210428193408.233706-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210428193408.233706-1-richard.henderson@linaro.org> References: <20210428193408.233706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, qemu-s390x@nongnu.org, cohuck@redhat.com, laurent@vivier.eu, david@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/s390x/signal.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index eabfe4293f..64a9eab097 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -137,7 +137,8 @@ void setup_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof(*frame)); trace_user_setup_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } __put_user(set->sig[0], &frame->sc.oldmask[0]); @@ -174,10 +175,6 @@ void setup_frame(int sig, struct target_sigaction *ka, /* Place signal number on stack to allow backtrace from handler. */ __put_user(env->regs[2], &frame->signo); unlock_user_struct(frame, frame_addr, 1); - return; - -give_sigsegv: - force_sigsegv(sig); } void setup_rt_frame(int sig, struct target_sigaction *ka, @@ -190,7 +187,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, frame_addr = get_sigframe(ka, env, sizeof *frame); trace_user_setup_rt_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { - goto give_sigsegv; + force_sigsegv(sig); + return; } tswap_siginfo(&frame->info, info); @@ -222,10 +220,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, env->regs[2] = sig; //map_signal(sig); env->regs[3] = frame_addr + offsetof(typeof(*frame), info); env->regs[4] = frame_addr + offsetof(typeof(*frame), uc); - return; - -give_sigsegv: - force_sigsegv(sig); } static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) @@ -259,7 +253,8 @@ long do_sigreturn(CPUS390XState *env) trace_user_do_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } __get_user(target_set.sig[0], &frame->sc.oldmask[0]); @@ -270,10 +265,6 @@ long do_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUS390XState *env) @@ -284,7 +275,8 @@ long do_rt_sigreturn(CPUS390XState *env) trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { - goto badframe; + force_sig(TARGET_SIGSEGV); + return -TARGET_QEMU_ESIGRETURN; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); @@ -296,9 +288,4 @@ long do_rt_sigreturn(CPUS390XState *env) unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; - -badframe: - unlock_user_struct(frame, frame_addr, 0); - force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; }