Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3337473rwa; Tue, 23 Aug 2022 03:07:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR415oJZpnc94LcODaZ5/OD01U+N4vx5mRxWjsjKI1UCPZlU0KEKb7m68U68Uha2zlrCwIjc X-Received: by 2002:a17:907:2856:b0:73d:a96f:a0 with SMTP id el22-20020a170907285600b0073da96f00a0mr199237ejc.151.1661249220219; Tue, 23 Aug 2022 03:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661249220; cv=none; d=google.com; s=arc-20160816; b=WDSdmlrfLwhZ5PF62ql78dFtaDBI9++Xl3lzwg9L4xq5eug5eKhsD/87LQQ/xzLojP oqUwu6wwogjGsmDweXsXtnTY1734mTmb1opjoF06mJxFfmRDw/BDY5e4eUEWHwtCU3BA 66Ann0vLnCCUSJs7vKQbNH7HqP1Xji1w8Lngbiil8L0ZG6Ywfj3gxSY390lfcqQuImTA 2peO5phV8fO5X08FFSKE2/LsvZs1ydEIM2SBEE1Ev1ULyp2y+ayfTVjEMS+wF2POvOQQ N0Km2XJg2VtAArhU6lHrHfCHDrrxqJm+9hwXKB0pUjGYYgByj8rlivu39oEuLQuM7cDn 6zSQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2B7x3XaMBeCwGMwtm2RThTXAItWs8bD0ahCzRaCkFp0=; b=akmvhijdFAP+w4GatV46+y+0zuZaU0PvO2r3UUvtboIrXB0SGb5sJmZDEfcX2jpfZH +Aq2zXy5novGQSrtipAcb6O5bUX1a5lsc7n8FR6KUKPSnzVeXNeYL0EgxtoLHO56KZER 37PReRoC0MRJpINIvpjGYCjC+f5knwvoOz5RErwi+kp2i1vWgj4nsgdXzRkivvqAkIZQ Ed8ne/MRmyNFUAi9JWVr7w2BkM33AQm/V0kXqAwoYRmWcg/4f39781VYVsirQDnv/eYa NdYQ5m26Mk5RaEvbOl5SYqHxzrE4eKPrRdNqfddSE+epeVXQCSc5lFo+Yumbe2z7hyAm C5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bx+k0r/u"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a17090699c100b0073c1d6b30fbsi13994162ejn.355.2022.08.23.03.06.34; Tue, 23 Aug 2022 03:07:00 -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=@linuxfoundation.org header.s=korg header.b="Bx+k0r/u"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242611AbiHWJyg (ORCPT + 99 others); Tue, 23 Aug 2022 05:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352290AbiHWJv3 (ORCPT ); Tue, 23 Aug 2022 05:51:29 -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 B57627B2A2; Tue, 23 Aug 2022 01:45:53 -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 67387B81C5B; Tue, 23 Aug 2022 08:35:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64D0C433C1; Tue, 23 Aug 2022 08:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243706; bh=pVh0kY2dRG6Xb0FG85icTj2NW55fBngQJ94RJpxzoGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bx+k0r/u0NXhsAjRaUXadsl3Ng0JaG9Qj6gv7lArn7Xojpfdhh0/H9BcFGVNGIsdZ HRWgFixBGRMJgABIWI61wksRcaCpZ9cQQETXrSPC74YkNaMfiPMIAQEL/n/vR87wV3 +dQQ0jHYTKW8KTQ/YAEqYJm5VOhH9urARgPbnJMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sudip Mukherjee (Codethink)" , Nathan Chancellor , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 361/365] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Tue, 23 Aug 2022 10:04:22 +0200 Message-Id: <20220823080133.394797517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 8dbbd99fc7e8..be4d4670d649 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -626,7 +626,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 { @@ -2565,7 +2565,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