From patchwork Mon May 17 18:14:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 440218 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1353191jac; Mon, 17 May 2021 11:54:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtu5ZbsRWnsZl3DJVDmctGGmQDGvTLEK/BqO1uypv1mGoYg0NOdoIm6Iilwt+Lwm4pAPtE X-Received: by 2002:a6b:5a16:: with SMTP id o22mr1190363iob.63.1621277664308; Mon, 17 May 2021 11:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621277664; cv=none; d=google.com; s=arc-20160816; b=DXE+l/Y8OfVG4Xomk6QqMpWG8/vjP/JOkKt1JVBXlFIwf1bGnbhnNGVWKpAS9XEw6s GUYq8MYoqXvPUOoTUbzi9xe5zRRbtYMYdoOlEtih0047EP12PKPCLdKN5i5eD8qIaH+P PVopeWPfuxBnCazbbHSs8v4JaEhlmFnlVfkNoz2RNJece80J5+V/wRLSISK4PMCCpUq2 YqMN0ZDcuDaeuv1fi6cjtq7adB8oYwE5Fh6O1w6o/ONVeB9Gkthh3uqk+LJBQeQk8VNh NBB91LKA5nQMdGdk+7DsbELXGg+MXAZ9TUNNqYTQvjcl9x72JIXQQZR+57khjs6BmGkY /L5w== 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=ezkAlje0+7gYtPTUEeiGHVlJcUb34LYjic61YdLMn1Q=; b=AvR59lcE/jjP0OyWTnckZSTIuElp2KUCfOo//YDgu4nAP1HrQkeLudQsyMt7197EG7 hub1HQcQudRbq8+rSy5xz4ISQpUZmITQLCNr9AzK8vFuP6YEHiplnU/8PPiI5N+9YCET LRMEdECQjkbYb7fWVSAO1uaa71mvh8CalObFVRtB5db89k0hm/sny+G9M/p4h7emOWc8 3sX21eGUzA9VCYnuSU7qDkfL3i20acagoUROQpc2wCZSxOoq+i0/TtL+EXEVDoZoDjpD 2N/4qks6oWPdTDhOP9O8KGglEov4N+YXMJBVlxcw5EtvebIAqWrmXjm2V722eUXYiok9 48yQ== 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 a5si5337971ilj.12.2021.05.17.11.54.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 11:54:24 -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]:50436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liiNj-0005In-OS for patch@linaro.org; Mon, 17 May 2021 14:54:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihm7-00076l-8O for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:31 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:48479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihlc-0004bT-Ml for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:30 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MsrV2-1lTFHc3BmK-00tDcJ; Mon, 17 May 2021 20:14:56 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 57/59] linux-user: Tidy TARGET_NR_rt_sigaction Date: Mon, 17 May 2021 20:14:22 +0200 Message-Id: <20210517181424.8093-58-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517181424.8093-1-laurent@vivier.eu> References: <20210517181424.8093-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:BlVMGI2zvZfRIVjR+rXCubQm5WdKvDzhBPC8hICZpzPMZ4acVYv yis88kGPYpRO63B/PJ1RsRelOMaNUVGW5es10Gu51hbiLLRwbkMG3q2PaVaRD/IR+q+vWfj Ig2htFXyinA1E0ZZzayeSiyS3l8dxPFgQgJhhOQIQX8sQtzXsBf21kyNAEKPenPYESD5hLS 0QrK9KJACNZegm+as5u5w== X-UI-Out-Filterresults: notjunk:1; V03:K0:D0wpYJislns=:QKASAKOlpjHTzRnvjt5klq rb8s4vJF/j+MPI5IDc5Io9mui1qBy29rYpUH4UoIJyZgoBabavdmOMAVr1/Byp+A6donhQrAc zc4VRLjZ5ji1LfoVq7fPDnXPKWU/D+fjOm4uu3LUnCKyaRS2f6VnkQrvrYDR8IdYnROHC2VpK ScC0aH+xb9Ds6Nc76DPzto1R10CoOAQIhcjfit0QHRAh2gdaaVe8DaSJh9O6Yq50MhLcaTrbY SsRsFk2JaiAXMVBvsVIugh1rEl4B8esFKJ7KKyeSDk4DLwru06CVYoHflDUvhHfY4vOlWD4sX ZeaJmMzw2JXktztQyc+DcZmV+SKH1gyGUDyJb1vQronwHA6HDQiCT6V0UF1aylk5BIwPB3i+V CNosD+IrwGhuoW4TRI4QkJOz+SeB1sRrg+ZlgIU8Nfl/tdHrud5/fRFH1R8Qgz/dXRQp1cqKO +RV/2tD1YRnfatIuyBHnrSSh5//bPrnfe9aZ0J3XwtJgi53ZGdGHiTgHBVFDsbzo/OBEzfkhu xTrDjjI4k2OUMkGCN4g4v4= Received-SPF: none client-ip=212.227.126.130; 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 2c5ced1570b5..0ed58e9f5c06 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 */