From patchwork Tue May 18 05:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 441159 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1805555jac; Mon, 17 May 2021 23:24:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRrpo+9aScVXbyER1ULcDnazaFt7SuED8MxMbPHejXL+4tyF6NyFcddg9t73zQMAMzQJKt X-Received: by 2002:a25:2645:: with SMTP id m66mr5263916ybm.65.1621319089322; Mon, 17 May 2021 23:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621319089; cv=none; d=google.com; s=arc-20160816; b=jyZX2Jp8d/806CjKekD0DCI2o13SQm9ZJgZ8BJJhIKpIcmHkn00qo/9T8kN0l7ndF1 bDJi79jP0xii4bVNiL0OdaVM3pwVGvB168pUHAhlRuQGVxDyGhriaHbnaNlLJgX/rTWW KROzHlCK1ok4KJehOhi5umNp6zGEloDA0QEbcudbTplyFSy6X+h0EigNGFrTxdj3wQgR D5RiJcfaH/CTZiGJfONMsJBTrtGu9bXU6u80mSFNWc0z0bQGjFCfvKwiwbGEnJ0wvZf7 AKyCNL3nCiNfF6QEjCvLr3h5LsVbYpKvpYoNk8L14ga+OrUuRRbohtuOFLGYWhanqJ0F j6xw== 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; bh=5EwMjvs1oXNiy+eDtodNLNQ21OiPDF6PStx666kZFR0=; b=z820XdT20pnI0X9bkVGPLy8Jg932PzqXHd9WU8VB3N9aTw2bufMsUSRMuRHzdUCU2/ AX0d6uKNwEjiEY7QmDZbi0NaikwqpFsga6y4E50rOvRRv8R3vgVaQLfSOIpwrLr0iS+v BdhNbEbcxVq/Siqi34aJRjxw47oluXIcETWxfskVHZ9LaDNpgnAB5J3djb1du+iZY/d0 RD0OlTWxfOdTNkY59uyx4CYV9TXecc77q9ZaKdubeaClsuN5scGMyjubVptLTL4o1IdD OT2mlC717K9ML/hqDisAdzbqHC486gChm89HD5D48r122hfDRPqeqRaHiEjjXLj5OkXc eUpQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d13si2671969ybq.436.2021.05.17.23.24.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 23:24:49 -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; 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" Received: from localhost ([::1]:53844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lit9s-0001MY-Rw for patch@linaro.org; Tue, 18 May 2021 02:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisL1-0008S2-KC for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:15 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:43111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lisKz-0007Jn-Pe for qemu-devel@nongnu.org; Tue, 18 May 2021 01:32:15 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mqro7-1l59nu1A6T-00mpip; Tue, 18 May 2021 07:32:03 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 57/59] linux-user: Tidy TARGET_NR_rt_sigaction Date: Tue, 18 May 2021 07:31:29 +0200 Message-Id: <20210518053131.87212-58-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210518053131.87212-1-laurent@vivier.eu> References: <20210518053131.87212-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:0pe3gBwIz6emDT9fggT5RQr/jQo58spTr4RgIxpGqL/TG9Z4cUd Us7JSbtXuvIDmnvjow4BMUW/eI/CAMTQhNI6Jsj9HtVRgcQdnXMy2XOGRxS4169TwkH2Hmx 2ZB78gzhw3Ly2zixnsLrIFnaJIFVFW+GcSJ6CUJ5afV5tuqDB3OgSQG3F03LjLbbZwTJi6G xxU+PZGvh1OUQWoBW5MlA== X-UI-Out-Filterresults: notjunk:1; V03:K0:1QfqtfjQhwk=:1XQv3s3mSM2b6dYj0HtNp7 WmjxbaZwv0qKqLfqW4GP4m2Ut/6lAN/v07UVFcs7CB0/sJTdif6VBFE0XNELVqC7l61HxvjQx EC0tG5pxSYYZgwrhMUC96OaCOq8pnOflxa76rvdksQePjxkat+6HqfwMj2tAx/Cj6moIruk7q gL4O6xFiihhca85+lblB5ZWO3WtecZn0xUi3DfHL8LjXvvoWj5H0ke6CNyFI38Sqiys4Zp3N9 h8zqi6Cj1fKUq1M9rV6EH3XlGjVoQLwuouAB9dEtpOkUnx9FYxFrCgXmcM6VHLoMjQvnUAYHE dhETxysqoNL7ziYYeAWsvj6yw7jmlQ40sX+iXbWXPtxpJKOfm7+uciospmy4JZbVGApA9O6i0 XQjK3F9YMj2C7arGpN7NLd6wCT2krP0+o7lGFgbXMIzDTY/H24wOPMignSp9KjCU98BcSJgID JyEmaMoBqQkmKUZHSDPlwldYaxTGYPhQXHa7w58BIV4vOtnCmXpM6gdVefb6Z6dTtbxsbxEYk 4BNt7GZ2A2Liwx47jVLGp4= Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham 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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Initialize variables instead of elses. Use an else instead of a goto. Add braces. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210422230227.314751-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) -- 2.31.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8d7ac1ebcffa..c9f812091c3f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9060,32 +9060,26 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, target_ulong sigsetsize = arg4; target_ulong restorer = 0; #endif - struct target_sigaction *act; - struct target_sigaction *oact; + struct target_sigaction *act = NULL; + struct target_sigaction *oact = NULL; if (sigsetsize != sizeof(target_sigset_t)) { return -TARGET_EINVAL; } - if (arg2) { - if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) { - return -TARGET_EFAULT; - } - } else { - act = NULL; + if (arg2 && !lock_user_struct(VERIFY_READ, act, arg2, 1)) { + return -TARGET_EFAULT; } - if (arg3) { - if (!lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { - ret = -TARGET_EFAULT; - goto rt_sigaction_fail; + if (arg3 && !lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) { + ret = -TARGET_EFAULT; + } else { + ret = get_errno(do_sigaction(arg1, act, oact, restorer)); + if (oact) { + unlock_user_struct(oact, arg3, 1); } - } else - oact = NULL; - ret = get_errno(do_sigaction(arg1, act, oact, restorer)); - rt_sigaction_fail: - if (act) + } + if (act) { unlock_user_struct(act, arg2, 0); - if (oact) - unlock_user_struct(oact, arg3, 1); + } } return ret; #ifdef TARGET_NR_sgetmask /* not on alpha */