Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp16278ybh; Fri, 17 Jul 2020 17:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaLGGbNZ0Z1b8x/Zjmai4ddI58TlNu8OA+mTNekwcOFToSluqUwrlZwmF76EEiK9EkdQS4 X-Received: by 2002:a17:906:3b9b:: with SMTP id u27mr11604683ejf.500.1595030564233; Fri, 17 Jul 2020 17:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595030564; cv=none; d=google.com; s=arc-20160816; b=c7Vjd7Ec0/auNI1bCnObCumPgP3N0hDkLpYfkQ0dSJzkVD8NJ3oCs1PNBXQimBJ9Wf sFcp+mtuwwMo6hDRR40+md71/C2wUwN3bL+pgPP7TUh0l1APDuFlapXep5zplf0Nx+T/ qNb2R2a1UfH1039URffg9clWYFz2XQHotiw+/E7OdEb6daLo98uhAayamaC+9qI1fyBO KHdZQMd1vaLkfJMZpqDtGBOvybpCX3OCSFS2g1DHcLG6FZviVegN7TY5NgJivh2Msdyu Y3FU0qLXPTnsQ9Ny7WKeh7g2KU6XXt7gOpBPdD4cM8e94XIoLlPJ7+Nc69DHVKe4ztnw 4B4w== 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=8XpgUWIGgeUWH6liOxP7uwaShsbMbEpbQlEspkHv2+s=; b=spYm/vyC13hcvhbrMn/m8hjyQ2WOhxLBxD36RTA8Q4Gy5arp8N34rcg/CvXQXhYn28 /tUW7PczooBlHFm3Mf1UJ6fMmYm4WQe0PGoacu+2MkFNqgfHPHj7p/dyX+xSRIDclwp+ vG4fIv/EU0/UW6ZmLqFwacSRmmXb6RsF/h1Bsv7WYoiEPd4V3JlwyBIe2iRLr9Az6M+u D6OL5yFwqysD7331k2SIkJOd1+xKyxU8hgdLb0f7RSpVfODAo/J4dQ5g7HyKOlcMborE qPbVACb0gHbe3RSVZukeflxcpgNZk3ORoepeCZ7DZ3MaPCvlvHpznqjRYmkBYI1HqxsN aQpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=Wu25cVGP; dkim=neutral (no key) header.i=@linutronix.de; 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 y27si5734083eje.284.2020.07.17.17.02.20; Fri, 17 Jul 2020 17:02:44 -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=Wu25cVGP; dkim=neutral (no key) header.i=@linutronix.de; 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 S1728452AbgGRAB6 (ORCPT + 99 others); Fri, 17 Jul 2020 20:01:58 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44216 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbgGRAB6 (ORCPT ); Fri, 17 Jul 2020 20:01:58 -0400 Date: Sat, 18 Jul 2020 00:01:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595030515; 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=8XpgUWIGgeUWH6liOxP7uwaShsbMbEpbQlEspkHv2+s=; b=Wu25cVGPUIA0Le25qGbhqBsnhXRht5KcmaACd/8LWsm73vrsc6Q9kYdNul31fcN5jgtNYA tIxtIcFcPpyOA+qxd8VvQQY/nCLNTnL8SnjoO+G2azcUlZLMDoqeBDdF7sATnGymoH5/um 0IQ/cL3qhpABDIgsLSNFoT5LKhmZLsMzudIMXPxydkXF5Ah2LjNOaggB02bNBwnRb6FmYn PlcihFE1/epIvk1CNmJrrmjiTE99dnTXBmuNAIRi0oqpqpCuqe49hoEZvvFajrmydgdPZB VNwxQ/BitjUyikAniwXDxcEnqHjqH5GM5hvVUbWqQtV5HfiPbvEVrjYc3nF2cg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595030515; 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=8XpgUWIGgeUWH6liOxP7uwaShsbMbEpbQlEspkHv2+s=; b=Qz1YMA79CaC9glnKsxPfVOkM508HDBVnDpYUCA22s02nZfHOvJ3ea3YPuLsn6ScWd8R4vF LfqX0ia9DsqocMBQ== 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: <159503051506.4006.14566660709766514564.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: 9261308598ad28b9a8a2237d881833e9f217244e Gitweb: https://git.kernel.org/tip/9261308598ad28b9a8a2237d881833e9f21= 7244e Author: Andr=C3=A9 Almeida AuthorDate: Thu, 02 Jul 2020 17:28:43 -03:00 Committer: Thomas Gleixner CommitterDate: Sat, 18 Jul 2020 01:56:08 +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 362fbca..cda9175 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -476,7 +476,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) @@ -500,8 +500,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; @@ -538,7 +538,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); @@ -626,7 +626,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; }