From patchwork Tue Jun 28 04:21:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585472 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp414585mab; Mon, 27 Jun 2022 21:45:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+rWcbgNRlXKdd47YJzrAIjbMvNTQnYawQXw5jY3ws8FWiqEwgRexu4ALViANpna+P0HmB X-Received: by 2002:a37:a448:0:b0:6af:dbb:e3f6 with SMTP id n69-20020a37a448000000b006af0dbbe3f6mr9230059qke.356.1656391510859; Mon, 27 Jun 2022 21:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656391510; cv=none; d=google.com; s=arc-20160816; b=MHYyxkno1aTaRQCkSF4N0fo2C5HmX+bGj0DHnchxqjcNPghbpy9QCe/lsNqrccLCj7 8ODFDGUcB52dAl7lOrDo5arpiZcm6wa/c54fn2Tg08aq3F1cnAl5Qi/E580tzWpcNY2f rBMBE/+6WPSSV7vmdzcUsHtfoQdOOJlyIPeAWWpx/71hJ4R5TTrl6VKQKJMR2aBjVaou ihJsPP9Hm1iDKqvANhr+Yi4JOLTkLasFBekQziCkrl6TcWFFN7YgsAML9/lpiAHU90Ce sHgkzg/Ec02cB6SxDWbhfGtbLbuXhWrP+qodsjvAnREVHyu86OSb5T8+B7blG60Ql4H8 qkGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=VPMml4Tfq67+y3oqJMSmdBs/iUTANF8r3DziFKMfYRY=; b=ev4ODn89HWLIq9rMmwzbZvlw2ad4l22aHEAqLbj0Hy3cv3/uy+fkn10AsNbRow7Q8P kG7dicsC86aExW58m2p39cHf6mGIEqc8GcpitmXxvIzGp9XudyL9wrV5jBY8Z3E9Q4kw aapFA4Uk4NNilDQQNFVwibycAfSsEFflYg3u1e99gD+02I1e22+FZiZa6O79OARQdqrR cV7FsQ+SZL/z7emD88jkjwsMigsj9s6R4JraZ86PUI6FGhIFzSJYHb5owCRrJtMGOxeP 2yHdKgTRZrXOzP+xC6G5y7iRDu9Fp6hyyXncsxpOwh/6SBHDowrcoNKkkuWtAUtOmtn2 vRNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qNMv5KJ4; 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=pass (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 66-20020a370645000000b006a8b6848555si6308228qkg.554.2022.06.27.21.45.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 21:45:10 -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=pass header.i=@linaro.org header.s=google header.b=qNMv5KJ4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6366-0000aP-Bw for patch@linaro.org; Tue, 28 Jun 2022 00:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o62kX-0002sA-Rx for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:38427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o62kW-0003mt-5h for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:53 -0400 Received: by mail-pl1-x634.google.com with SMTP id m14so9985013plg.5 for ; Mon, 27 Jun 2022 21:22:48 -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=VPMml4Tfq67+y3oqJMSmdBs/iUTANF8r3DziFKMfYRY=; b=qNMv5KJ4/nrWDTYoTfCVBMX18+24NTGEJBQX0ZTv0L+ahPfTg5P6WxN8SLRKd7VnQ1 gGHWIaNAZFu+3X+qTv9QqTIRRq9Swtlh+BlIfurGpJmUS0uFm2s9/o3Y1lRAxTtl4gZi xwphL7fgW42NeUufUras1zZDD/MpKBobJBOXzVQ91B/TuRH5uleufFlb4FqaYGFoSZvS x0uYL6S180ghHP0Zsy8JwUVj33M7R2bLoVlACt2dmS0G2EfYgquclUPb7iP1k8Jc410m yJ0Zd1vR1gTUVm8iLEMbGBgrlDYNuAeUjNC/ZSA5nqWBRmFabEEw9DrDCrhKdKqD64sZ vD7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VPMml4Tfq67+y3oqJMSmdBs/iUTANF8r3DziFKMfYRY=; b=2JvaHgil/VMlYYyNbFdEO11z/mcp37Mxr6Kv0sZNYjKAWtc7V7r8fvPWL6EY6BtehY I0uTjJv5LVX/JPPoJ76Skhu1U632WQSPdD8Jkrw0ABnpaM3m6egAu3o0X7iOCVwF3f5H lXwtmemPDJEoIXQKlFesjIZEp597HNuWB2OUCtOK9XlotaUKtMCx/1GsAGyxNLIgS+BU lptvhycjNjn6GjlovLeDk7jskCATPxtMQ66MvgYScvlOspuNlZKdOANvc64eNa9yzHDP 6eExP2PLhttz9N6aH/dGGGqdkzEMCIMRThHnznaiUCgJ7Bqddwci/D1lrOh+zxl2gw90 9EQA== X-Gm-Message-State: AJIora8LcTlSuRknNuxpR4Pw5VAd6DGFvRtEWE4Z1CyQzBCfw1Z20jEk ZHfBEb4MmvsT3zeEMgqPeV3+jEDKPqulfw== X-Received: by 2002:a17:90b:1b4d:b0:1ec:c42a:7eb5 with SMTP id nv13-20020a17090b1b4d00b001ecc42a7eb5mr19503118pjb.122.1656390168179; Mon, 27 Jun 2022 21:22:48 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id jg6-20020a17090326c600b0016a087cfad8sm7994929plb.264.2022.06.27.21.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:22:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v4 36/45] linux-user/aarch64: Tidy target_restore_sigframe error return Date: Tue, 28 Jun 2022 09:51:08 +0530 Message-Id: <20220628042117.368549-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628042117.368549-1-richard.henderson@linaro.org> References: <20220628042117.368549-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" Fold the return value setting into the goto, so each point of failure need not do both. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/signal.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 3cef2f44cf..8b352abb97 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -287,7 +287,6 @@ static int target_restore_sigframe(CPUARMState *env, struct target_sve_context *sve = NULL; uint64_t extra_datap = 0; bool used_extra = false; - bool err = false; int vq = 0, sve_size = 0; target_restore_general_frame(env, sf); @@ -301,8 +300,7 @@ static int target_restore_sigframe(CPUARMState *env, switch (magic) { case 0: if (size != 0) { - err = true; - goto exit; + goto err; } if (used_extra) { ctx = NULL; @@ -314,8 +312,7 @@ static int target_restore_sigframe(CPUARMState *env, case TARGET_FPSIMD_MAGIC: if (fpsimd || size != sizeof(struct target_fpsimd_context)) { - err = true; - goto exit; + goto err; } fpsimd = (struct target_fpsimd_context *)ctx; break; @@ -329,13 +326,11 @@ static int target_restore_sigframe(CPUARMState *env, break; } } - err = true; - goto exit; + goto err; case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { - err = true; - goto exit; + goto err; } __get_user(extra_datap, &((struct target_extra_context *)ctx)->datap); @@ -348,8 +343,7 @@ static int target_restore_sigframe(CPUARMState *env, /* Unknown record -- we certainly didn't generate it. * Did we in fact get out of sync? */ - err = true; - goto exit; + goto err; } ctx = (void *)ctx + size; } @@ -358,17 +352,19 @@ static int target_restore_sigframe(CPUARMState *env, if (fpsimd) { target_restore_fpsimd_record(env, fpsimd); } else { - err = true; + goto err; } /* SVE data, if present, overwrites FPSIMD data. */ if (sve) { target_restore_sve_record(env, sve, vq); } - - exit: unlock_user(extra, extra_datap, 0); - return err; + return 0; + + err: + unlock_user(extra, extra_datap, 0); + return 1; } static abi_ulong get_sigframe(struct target_sigaction *ka,