Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1714518rwb; Sun, 14 Aug 2022 10:13:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR5xgmU6XxMvzDoeW1T6dNuQHyRZjEKsR40jHAHIbgUjYDJiCGRg6awU2eJEc0R6L9iK/p0i X-Received: by 2002:a17:907:1c8a:b0:6e9:2a0d:d7b7 with SMTP id nb10-20020a1709071c8a00b006e92a0dd7b7mr7867124ejc.572.1660497202001; Sun, 14 Aug 2022 10:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660497201; cv=none; d=google.com; s=arc-20160816; b=pRCIDOHNaJcdzgidIngQ5XAh1wc2oRmCM4PDvjMY5AJJ9uvx47creUPzYZhPZynU8o w3eidhFMCG3EwqBit5IPGOdGzrVaA2sv4Aoq0a9mhzCyN+gT4AM9rcD3fFnDpifFNlTn mZ2lN8aGhWjyK2Sg9lAzjkGJMUVdMfvvfTctQNPI8kF2K0MDOXRaZtHqLcJ7SUXe/Ja+ OlbYcRvlr8vX1R978DLEpv/ZNSduvmv0cPlCFkjQwCvVW3ED4KtN18nCUXtxP7iuMLJ1 qacntINq/qpGA6B7wNNJOC5Zn+YEeFVQ2dsn+89twPdJlWU7C5ghAdeaWLEW6leVQ1Wj oTAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ItxCtfamnjFGLx0DHpHJH/8Ncq9L0Q12b+yhRHa3KAA=; b=KQwiL5NFasdGBFGMjHqQi75DSb3+wlY7KcOH1p5v3wUUIkRE4JxhHvolupH0CoyNWE 0W8yQZIFdbKXW9h12MRX0vdgviqv8Bs5eoRoexR33J8tYB6f6rvvAyOMj+LEPnA17XiE WUwvXAKoA87qDf2iAq+p0AjdbnjemuiQGh/2ZgFSQhOGZAEnZdWUqF9h7R+uH7R75xnV hyQpY10F2iDoUKt7zwC3IbJm3WBx3fJwcC30kLZjCZlmGab2mIFNVo2r77Pv+k2viCJa qfiC0j+wmiLn3jzd6uf9dshA/0MnYjMHmf86+u0N/VXSWh2wH87xI1pKhsMbeH92Y2dg qsUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQq9OA2a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a05640234c500b0043e39c683f9si6522557edc.556.2022.08.14.10.12.56; Sun, 14 Aug 2022 10:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BQq9OA2a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242825AbiHNQgj (ORCPT + 99 others); Sun, 14 Aug 2022 12:36:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242745AbiHNQeO (ORCPT ); Sun, 14 Aug 2022 12:34:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285D219C36; Sun, 14 Aug 2022 09:27:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DDFB3B80B7E; Sun, 14 Aug 2022 16:27:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79702C433C1; Sun, 14 Aug 2022 16:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660494457; bh=7fWuYtg1B+J9a2WfNzdv9rvcTUNgHSU4aummuoGeZCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQq9OA2avyDPz5JFFs2emYl2Vw24fxPySUwCDrU/aNFLY1w44UF1rA+HGaUTgYZ79 FcpvKf3gGPtRCQSx1hcAsgQDyXopfnYVjus3u7Nrvk30xLcuwCMLEis/+bKNGxcgPD xC33Fes8Oo2TWzHts6istBFO8fKD1zoxQ/7E3Tv7/sdFU8XzhoQtqKr7w0svXbhWx1 B8GHXydBpljc+O3KqUjJYV8GlXGxwI8AEsMOpHxOvcbUipX6IfvnpwPjT5pgIX88UU JVpq4ZbgMMYMYH2Ras8T47EgMGIuCLhAPXdog/RAuEEP1615Be3v3vqTowRChCi6MC uEcaX58SutjWw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Sudip Mukherjee , Thomas Bogendoerfer , Sasha Levin , ndesaulniers@google.com, macro@orcam.me.uk, linux-mips@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 28/28] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Sun, 14 Aug 2022 12:26:08 -0400 Message-Id: <20220814162610.2397644-28-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814162610.2397644-1-sashal@kernel.org> References: <20220814162610.2397644-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ] When CONFIG_XPA is enabled, Clang warns: arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context] if (cpu_has_rixi && !!_PAGE_NO_EXEC) { ^ arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC' # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) ^ arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context] if (!cpu_has_rixi || !_PAGE_NO_EXEC) { ^ arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC' # define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT) ^ 2 errors generated. _PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the build and runtime configuration, which is what the negation operators are trying to convey. To silence the warning, explicitly compare against 0 so the result of the '<<' operator is not implicitly converted to a boolean. According to its documentation, GCC enables -Wint-in-bool-context with -Wall but this warning is not visible when building the same configuration with GCC. It appears GCC only warns when compiling C++, not C, although the documentation makes no note of this: https://godbolt.org/z/x39q3brxf Reported-by: Sudip Mukherjee (Codethink) Signed-off-by: Nathan Chancellor Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/mm/tlbex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 046d51a454af..3471a089bc05 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -634,7 +634,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p, return; } - if (cpu_has_rixi && !!_PAGE_NO_EXEC) { + if (cpu_has_rixi && _PAGE_NO_EXEC != 0) { if (fill_includes_sw_bits) { UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); } else { @@ -2573,7 +2573,7 @@ static void check_pabits(void) unsigned long entry; unsigned pabits, fillbits; - if (!cpu_has_rixi || !_PAGE_NO_EXEC) { + if (!cpu_has_rixi || _PAGE_NO_EXEC == 0) { /* * We'll only be making use of the fact that we can rotate bits * into the fill if the CPU supports RIXI, so don't bother -- 2.35.1