Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2307741ybh; Fri, 17 Jul 2020 15:01:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzaZe8d1bd4twlYZ5okR9zNNWBry1pVoMOfUaYTMRlPzqFWI6xTHlEEExi1o5paiYytSNp X-Received: by 2002:a17:907:72c7:: with SMTP id du7mr10176785ejc.248.1595023317065; Fri, 17 Jul 2020 15:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595023317; cv=none; d=google.com; s=arc-20160816; b=oVgRY4adqx4W0pW7omJ35IuVbBRA5ondWzyyE3KiT8ICkgveA+45Y+7t5MDw05NL7f tD6ljZK/84Aya2tutrQngv8pc0H7RAys0twCfdZQFJY+n/kVOY1247Uetmc9EiR6+Op1 pXcLrh5FuB0e6msx6uRDqLTZrcIEES7HQVkmpDvWlo4weAfMhyp3YI5C1XQxG4m5Rxu0 Qf2kDdBEzdcsSPkwo4wLjmmK8HV5hgBIjMOeIq2ahqupvRexW8KpbvjYv7Ui2rq1HIhh ADQh2WED3Ad2czGydv4TAyh/QB9zHDPLyuZIQ4A6yrnnqJ83ZnadlBNEhHpgqs9bN/kt XiiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=Iq2LHIRGvY3jdOkMPmgQwTtwfsBH7dNLLPKY0AWtYHw=; b=QZEnBm9facKKx1iF2Kl4iuweWqeooIcOuq0glf7HJUMr+JnQkCKpXRNrLekrmdvkqO psTnZkSozwRKEeODmt1JxktZkWMLFJFVeTqjKbi+zUcLI5DG84PgKdXBwPyNdSSDKifB Qt+V8epx7dE7S6cAPjUruM9Nrr4Bl4CeJYzXp4K+urx/lw7gxgYgcmZKuEWvl8htJh7r CGL2w5E4HtrInX9dHaF4+SwUUlxQnywRRWZ7c+lncw7v8dj8uilVfmkltyqj66COk3jN IpWDDwIZgeaeK8vSxLXbvvEx+3P+iHa36dmDfWj63OOAGEKqWyeAb+u4VEfKj0FAQ5yh aCSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=apu4BkRi; dkim=neutral (no key) header.i=@vger.kernel.org; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si6543420edv.231.2020.07.17.15.01.27; Fri, 17 Jul 2020 15:01:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=apu4BkRi; dkim=neutral (no key) header.i=@vger.kernel.org; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727915AbgGQWBY (ORCPT + 99 others); Fri, 17 Jul 2020 18:01:24 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:43490 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726929AbgGQWBX (ORCPT ); Fri, 17 Jul 2020 18:01:23 -0400 Date: Fri, 17 Jul 2020 22:01:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595023280; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iq2LHIRGvY3jdOkMPmgQwTtwfsBH7dNLLPKY0AWtYHw=; b=apu4BkRiTfc+RFYjnYaOqZBGT+C2E7c1zUCEoia8XWInaozF9Ro3wxm/C5XfKY01DiyrdM Rq+r0NK9QBhcZzTT3L5h2qRi4NHkyLk4/1xUoS5FLtyP/wrQhXcU3xA29h8G21WzS25geh esstbCBr0TPbf6YwHcQl4tTZUSO/vgDziXTxedYKFFQjgT29PNZP+0Cv2zcLS8sSWEO4x4 XVmIBV92b+s3AR7AtP1VDLzZOcrsXLQ22spOmk8OJBFmZdYCrCum4qUNuGToIRSKlXdmQ8 rtlADvT7k32fAmFE85gmOk53IbUgoLIGb4wbxBiPGKOyUYWtyYIK+KxNSPOvlw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595023280; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iq2LHIRGvY3jdOkMPmgQwTtwfsBH7dNLLPKY0AWtYHw=; b=XVdOLChUbaUI/4UDNPDIoQhi5wSCIn8/LZyllVQCQn0D8rQUiH/0pg+hnlgtThOaTzT6cL 0AVOfztrzR/NmOCQ== From: tip-bot2 for =?utf-8?q?Andr=C3=A9?= Almeida Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] futex: Consistently use fshared as boolean Cc: andrealmeid@collabora.com, Thomas Gleixner , x86 , LKML In-Reply-To: <20200702202843.520764-5-andrealmeid@collabora.com> References: <20200702202843.520764-5-andrealmeid@collabora.com> MIME-Version: 1.0 Message-ID: <159502327949.4006.682740557157718510.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 2f3cc106873cb8234300c381a96b0b0e4ba63ab9 Gitweb: https://git.kernel.org/tip/2f3cc106873cb8234300c381a96b0b0e4ba= 63ab9 Author: Andr=C3=A9 Almeida AuthorDate: Thu, 02 Jul 2020 17:28:43 -03:00 Committer: Thomas Gleixner CommitterDate: Fri, 17 Jul 2020 23:58:50 +02:00 futex: Consistently use fshared as boolean Since fshared is only conveying true/false values, declare it as bool. In get_futex_key() the usage of fshared can be restricted to the first part of the function. If fshared is false the function is terminated early and the subsequent code can use a constant 'true' instead of the variable. Signed-off-by: Andr=C3=A9 Almeida Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20200702202843.520764-5-andrealmeid@collabora= .com --- kernel/futex.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index 697835a..f483bc5 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -458,7 +458,7 @@ static u64 get_inode_sequence_number(struct inode *inode) /** * get_futex_key() - Get parameters which are the keys for a futex * @uaddr: virtual address of the futex - * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED + * @fshared: false for a PROCESS_PRIVATE futex, true for PROCESS_SHARED * @key: address where result is stored. * @rw: mapping needs to be read/write (values: FUTEX_READ, * FUTEX_WRITE) @@ -482,8 +482,8 @@ static u64 get_inode_sequence_number(struct inode *inode) * * lock_page() might sleep, the caller should not hold a spinlock. */ -static int -get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum fut= ex_access rw) +static int get_futex_key(u32 __user *uaddr, bool fshared, union futex_key *k= ey, + enum futex_access rw) { unsigned long address =3D (unsigned long)uaddr; struct mm_struct *mm =3D current->mm; @@ -520,7 +520,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex= _key *key, enum futex_a =20 again: /* Ignore any VERIFY_READ mapping (futex common case) */ - if (unlikely(should_fail_futex(fshared))) + if (unlikely(should_fail_futex(true))) return -EFAULT; =20 err =3D get_user_pages_fast(address, 1, FOLL_WRITE, &page); @@ -608,7 +608,7 @@ again: * A RO anonymous page will never change and thus doesn't make * sense for futex operations. */ - if (unlikely(should_fail_futex(fshared)) || ro) { + if (unlikely(should_fail_futex(true)) || ro) { err =3D -EFAULT; goto out; }