Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1773211ybt; Thu, 2 Jul 2020 13:33:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0e8qaayuz2tyvhYIYnpS9ckDDloVHlMlDmHqBGAEOjfAXLmH41Y9og6S6MBoFpZN5FMN9 X-Received: by 2002:a05:6402:1597:: with SMTP id c23mr35278077edv.243.1593721980118; Thu, 02 Jul 2020 13:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593721980; cv=none; d=google.com; s=arc-20160816; b=qQwc1tsD+6N3wAv75YPlNTexIiu80T70r6eLJG+IEhaiaql5f2G8IgLeBBhwX8ol7E HrXQnqOrHAxkfETRxbC6iqQDPvixv8BUQ0exhRAzuCve4FyxvIVmjqFbjKZvvBdqxkQz /t8NRg/4QKLboWk74d3AGkQMR+Mj8VGIqD97B+OkH4Znhg3QHnShll0VoQtxKdrtD+oZ qpwauL9+kSlkqSBYeZE4oNpMjPPGFsoUMDC5X99g7Hz6xoay6cnlfdWv3r0/V58eQ/GQ xessu3EoFck4vkWy5P8ue9sla9iWnKOW/9b0PjzIghNG+UGXAIBiciXzQZ1QfDDOlSaQ fD/A== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ote1A6iMNQriKnAteNfOY3QyAc80TBmWMUoruHLD/iY=; b=dFAQZVA9bAw1H6C/akAU2I4C/7uSTGyA/l4KQDFmsB7HI15RVBkStwXQod82AMem8y u0qbx0yp/bvVM8Rr27awTVEmQW9VbfGmLSk6BFKMq57XLHAYUEbmDzdZeBGdo1JE+YST tIos7L28z1LExLe5MwM9ZSCDnw5sR3oPY+zD8XvIqafe0oaeSETWWu8tIfcob/TQC34g IeUB0lphGpD2Fz7pLFXFK4P6RANN0COR1C2Ws7Hvpl9CBDE8QRrI3uNpqTt4cJMFQgZC vf0tJUvcwGIHVeWMnMoNWZvpPlcwUxYy657B4d1zAyPtyIBBLN5LE7pUFC97MkSIZf5I eLrA== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n93si6969898edc.420.2020.07.02.13.32.37; Thu, 02 Jul 2020 13:33:00 -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; 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=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbgGBU2s (ORCPT + 99 others); Thu, 2 Jul 2020 16:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbgGBU2r (ORCPT ); Thu, 2 Jul 2020 16:28:47 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D518CC08C5C1 for ; Thu, 2 Jul 2020 13:28:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 40B322A6103 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org Cc: mingo@redhat.com, dvhart@infradead.org, kernel@collabora.com, krisman@collabora.com, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [RESEND PATCH 4/4] futex: Consistently use fshared as boolean Date: Thu, 2 Jul 2020 17:28:43 -0300 Message-Id: <20200702202843.520764-5-andrealmeid@collabora.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200702202843.520764-1-andrealmeid@collabora.com> References: <20200702202843.520764-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since fshared is meant to true/false values, declare it as bool. If the code ever reaches the code beneath again label, we are sure that the futex is shared, so we can use the true value instead of the variable. Signed-off-by: André Almeida --- kernel/futex.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index 697835ad5bff..d56c9310d734 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) @@ -483,7 +483,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 futex_access rw) +get_futex_key(u32 __user *uaddr, bool fshared, union futex_key *key, + enum futex_access rw) { unsigned long address = (unsigned long)uaddr; struct mm_struct *mm = current->mm; @@ -520,7 +521,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a again: /* Ignore any VERIFY_READ mapping (futex common case) */ - if (unlikely(should_fail_futex(fshared))) + if (unlikely(should_fail_futex(true))) return -EFAULT; err = get_user_pages_fast(address, 1, FOLL_WRITE, &page); @@ -608,7 +609,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a * 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 = -EFAULT; goto out; } -- 2.27.0