From patchwork Mon Jul 11 13:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589387 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3319072mab; Mon, 11 Jul 2022 07:55:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vH1vHDuweYpZnwPKHQi/ejprwXw8YHDXrmWSns8MY2QBI5eWEdYbygm6cusrRLWcxzsJU0 X-Received: by 2002:ac8:5c86:0:b0:31e:ba16:23ae with SMTP id r6-20020ac85c86000000b0031eba1623aemr1160613qta.531.1657551341097; Mon, 11 Jul 2022 07:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551341; cv=none; d=google.com; s=arc-20160816; b=dxG+N8Ojj72LUEdzHB547aav1+n99uIDuX2/ciwBGDGyBPXa/ir4hJpGm8w9XhH43i PwupgiJQ+gmTBfIjVmzaoE41MwKKzoYbogweie2GaPWmkqsWMD3M3Ez5vecmvAqM7KDe r8Xvm2mBQgTMfZAOdGh46WuvdhwjcTXMt2xQIuuLqce5ahqLdBoL6WjlJvJpD0K+OWj/ h6v5AHy34fFkFCleTK63mCODpXjdy5Gga2qvnO5kJ9ON+iYtbegfF4E2k8gmyfh8bkqa yg2Rg99j0mGNYAlIdrmO+WEYeysMEgAegS9phJDCL3VSiCT6oMJsybXEd4MP+YS54Ygk AQYg== 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:to:from :dkim-signature; bh=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=; b=IfNqzNem+y+hduT4OEdLOZ0LqDjzpJ8iWj4Ny+MZEzKla/kAbYPxXojimJ3IHVmeKs 6vXWk4kYd4EiyYDH22Z6PXdUZnBVgI6aYrc8u4nEvXAtF2hcW+q207Qz5+nMbeh+x8Rv z2PZyb276JAzRXRlQccoJFc7/VjlMpje+ayIdNENwsrWNczbSjhZTPzhvXN+syn3xd2u 8cnO63A8Ie1AJsboG/bvqe8YBOfQPtFeqh3BK0ojpQgkb4Oy3lCWI4O+HcBTKklc/OFy 2xlfuyaoZ/KXeLn4+1lJkI68bh0FOmXsnsQhDQ09V3pYuZro1lq8smF74L7rrfASzjPS ns4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6PyNrCY; 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 bw26-20020a05622a099a00b00302e1db52a6si4418663qtb.13.2022.07.11.07.55.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:55:41 -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=X6PyNrCY; 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]:59912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAup2-00066W-IW for patch@linaro.org; Mon, 11 Jul 2022 10:55:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvm-0006j3-G2 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:46667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtve-0002qA-5A for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:34 -0400 Received: by mail-wr1-x42e.google.com with SMTP id v16so7100831wrd.13 for ; Mon, 11 Jul 2022 06:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=; b=X6PyNrCY9wUsRlxJekVAJhNVAE89o9oikBE1X4XgdGxyapkElTVdVuP/RDJf9r6Y2W Cng4pVnTbOfEu4BtTGLhr6Lywl3zLifv1bEdFnPbfLyGfhgjkhfmqmWYTA6fwo29+2Py Qe8CDwxZqxgItaKmaffIqWbd2Llftl+Xdh1Cmn+/zTOYOnz/u7OchbogdzE4fqQXCDo7 troV4Ufb3UWGdbHEG3Hzv5Na+lJLjC1qBX9xB+gAxmFyPqHW6PVvq3p+1VWPJxYhYqEn 5ny5WQwyJPjceUDbkbYrm4nRGdBFHGPfM7SNl3715C3f1sIcDtYejmTl0VsZsZdN5qTM cgeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=; b=Ps/9ZFyptfO5GFs0dYnruss92yGOP9GjuLqt3h72+Fb3lXpP47O50yvlP/5a0gwpLV 17VZYPi6pJD75J3oZTwFmeHsdUdK+HjQGeFiVG5n1BmCqqaBsxXgqw+/FIqhlP81ggmb 2vkLwNVwHuaiR8R+Jjr6md7EgSQ9k+ocbSwKA8vDSwxn6qPU+gtlJ/dEdpKOZu557U0d aVon6DYzfD6pjCCxBCj+eVGgisxghSmJcTRQLIuNMBjhbBWjIHJiVq85TIjnBfi/7Xnu t9IOz5lsWJCSgvqtPiXE3Pq+WMBWUhUBwav9P29UUpBfh2IKsQhIOMSwcwKw5QlCqviV UzjQ== X-Gm-Message-State: AJIora+F1LDJ/qfiaGhSn8i9JeWKOzrN3NVY/IBmNp5/kte45888Ir7L /s+KsimA7GyBLPevhAYZ+WkcsNqo7GVFVA== X-Received: by 2002:a05:6000:15c3:b0:21d:9f8b:2c3e with SMTP id y3-20020a05600015c300b0021d9f8b2c3emr8368779wry.72.1657547902271; Mon, 11 Jul 2022 06:58:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q123-20020a1c4381000000b00397402ae674sm7595596wma.11.2022.07.11.06.58.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:21 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/45] linux-user/aarch64: Tidy target_restore_sigframe error return Date: Mon, 11 Jul 2022 14:57:41 +0100 Message-Id: <20220711135750.765803-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711135750.765803-1-peter.maydell@linaro.org> References: <20220711135750.765803-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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" From: Richard Henderson Fold the return value setting into the goto, so each point of failure need not do both. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-37-richard.henderson@linaro.org Signed-off-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 3cef2f44cf5..8b352abb97c 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,