From patchwork Thu Apr 22 23:02:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 425888 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp788781jao; Thu, 22 Apr 2021 16:08:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7Ru7mPa85UlKsuzL3wqVH41H7/NwTjnvs8KWkPMCxQvvectLsWWt9Aysr9yx5xGj3dySo X-Received: by 2002:a67:60c4:: with SMTP id u187mr1067170vsb.12.1619132909079; Thu, 22 Apr 2021 16:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619132909; cv=none; d=google.com; s=arc-20160816; b=pgCRhQwxXDZs4Ax/Vep0PHMgf+7QrDj5KjzyXnRAgRokoo8Ls6+Bw5Hcqf1LEj4lzC IMyMDcANqUKWPyYyPyxscQu4H9lPx4+XfjSDVdyX2V0Y96skItK0tQhwDHq4JNDDQ/0t hWr2y7T2mHAOFtA2UHjmqy1dxYNIriSB4FJNDrEXc3mXNry9qYxPjhPDpBuSDaHsiX6g 5795ySmYTpKjtEeeVtdpVOENlSh/74xui70DC5P80RTpgT1dKCpwlTXhs4BCWppjRCa+ aB/3pcU60dRk7gI0MblUysPauCuHBwhINgh2guNYi6B2GQPdnudo+EnZI+N+w7vGUhMJ G0UQ== 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=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=V9T41K2WB3bwEqcVqgJUuOfZR5Ws4tgAr4x374CZ815ryAGgdEE3+JS4GyWTeXsJbJ afWgv+iaYmxZshov+ryvm1ujggLXEKX3F1VcX2BKJU3jgW20xFLStmZ6qWN4X8DJ/DMy VNCzjacwd3vaysLAHfAz5Tee+B1aBWRLuoB2BWNOsAHcPo00Ovcl2+SVxab7kcIrXSM9 jfocDhQDZuyvYGF3dZ+Oa8pMuhknft7ewKUoTd/Tk4U4Pf2Q8gIL68UA//6bsTtkOCJS s9DRDQahwUtv6KmUySxA+QEeoG9lUwATsZYlWyLD9mQNmBIIDslRN3wgwB9Ey/6YnT8F RsJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4QyKbBA; 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 n16si2648765vkq.32.2021.04.22.16.08.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Apr 2021 16:08:29 -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=C4QyKbBA; 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]:41774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiQu-0003AV-Hg for patch@linaro.org; Thu, 22 Apr 2021 19:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLF-0005Ck-5l for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:37 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:39913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLD-0007pY-HA for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: by mail-pl1-x633.google.com with SMTP id u7so22494823plr.6 for ; Thu, 22 Apr 2021 16:02:34 -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=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=C4QyKbBANIxwH1YFMbdaY3BSVgMwjkdCbJ8cZPHBoIwx1zIxj9mDEdfin8uRo/p/Pt i1qwlJPHlbRLOOnthiFVWEpdZbkTF5JQnF/8ekARH+LQ6CW/C/MvyZN17xUMrnj9wTdi j/h4AM6dKUSF+j5jiRFxmFOo79z/y9rAjPttt11qKT6WAh0s5nEF715C0LjCCfhz88a6 E25AREdKNsasDGu8rY40qKNo/mvPeiGjCUyPioguruGBzznjancd0T5J7fcW0nbz3f6b bZmCce+Cw8+9bvx7UtVL2HMJbV9XtT8wUlCoEV+ZQuixfli/ELuO+EOxYriZvViR4c8q dtIg== 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=LKfV1I/Csk0qYQwhR0M4lp6iP2nYp4OTkUQuJPZGosY=; b=bmN/8EH9Effo7A1tC4kTCwnQkNYaaRlRxMQgl0s6ZdHpzftNROukyP0dynAEHFnJkr K1twtAZ8+wBpDLzpe9/qr9aKaICMSJpIPc6LtzOtb7ZKQMpcGRenequeBMROIZkUPSwM sWDaOBRH5SXceleqCO3G9S98vXc7PpDqyDEINAu+dL7IOBtl1ujyBYsrO+TzEDsGfNhK 8SWD06Ff8JS1uwJfifvzAswx+B9B6pcW8JxG9hZxZCiClTrdlmHfxiApdIIK0apWW1/X vGZtadv6RpHKfoK26E+wQ9myuYk1bmhMJpM+GAvoI0UTkwlLDCBloZIpK9Jf48WD6NXb kYAQ== X-Gm-Message-State: AOAM5322CtnbpBsBrOkKu4FZfchM+/jesWH4/++nCj3D26XdsjbGgw5b 4bR+DnDxnVCWUcVc5bI6FwXhsffd15jrNg== X-Received: by 2002:a17:903:18e:b029:ec:b394:981f with SMTP id z14-20020a170903018eb02900ecb394981fmr1161614plg.6.1619132553950; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 7/7] linux-user: Tidy TARGET_NR_rt_sigaction Date: Thu, 22 Apr 2021 16:02:27 -0700 Message-Id: <20210422230227.314751-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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=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: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Initialize variables instead of elses. Use an else instead of a goto. Add braces. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9bcd485423..c7c3257f40 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 */