Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2659751imn; Tue, 2 Aug 2022 11:04:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tiWFw7fBKPdkZTkPBgzyxrkLbxc+pOFg8SfYOQaFnOxQK3i/PH7sxVy/MmpYtZHzg3Tuci X-Received: by 2002:a63:6c49:0:b0:419:a4c5:cab5 with SMTP id h70-20020a636c49000000b00419a4c5cab5mr17292321pgc.123.1659463480965; Tue, 02 Aug 2022 11:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659463480; cv=none; d=google.com; s=arc-20160816; b=YyJyXcmQNhza3tbdbkAtzzyuLgpmobXOBepPU1QmxFZ6EsVlC5Exf89oWJ423K/Brn iXDzeQ9Fs61DFOX8NjH0aGQGVXTsv1G3xhDBnEQwZ1L9BH8he7bm02doNnLbt2s36eUZ 1foaNRBu1gcfKIiZdTw32WveurmcfwGz5BLbLTDvUNOf4aTO239H2vPfAmrupM+AftcT rvwQSM4cz7K0WE6OTTWBCtVvX4BFhpRb85MrcVIZgImsN8XGOGlW+9DbRjXVMuQ9PU2y TGvCMXPbTXfaK4GlTbiTRsyun85RCmbeaIhIBcAbrEt7TnAvOkebl8yY+IKF3kw1D9Nf MrcQ== 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=pxTpTBJBq2B1kXuMKesgbABKldI7lCP72jZ0m63mKvM=; b=TsRj2GqD09jxLSHpuRYoWvZx+sIZsKWP7lKArJRPvM6/DG/ejAqLkCEbJANFE43P7D xggu8T0keY4gqLPgajJjeDjfy4eiNvawYsED4gP+imka1bLxJ3Mro0Q29dbg5mOYIKMc qj2vy5Sk+I+TexWoN7fg1PrTgIO0U9HDz7/p54HS5BzaDVR9wZjmItlMy7v7YRd92/b7 i/psFPkX0ZOrAiSM6PF70g3FKeDnI0YxrqZUfSkeYM8oLJbKeSCqYy6AceQBWMWda40I iTJuTqWYVbPpZc9gI5oU9L2o2f9qA0luterBf38X4LYE89l33sFJzAlOtmfPxSI+FURl Q72w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V15liBSs; 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 k20-20020aa78214000000b005283a29e7b7si14997967pfi.115.2022.08.02.11.04.25; Tue, 02 Aug 2022 11:04:40 -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=V15liBSs; 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 S234462AbiHBSAd (ORCPT + 99 others); Tue, 2 Aug 2022 14:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235477AbiHBSAA (ORCPT ); Tue, 2 Aug 2022 14:00:00 -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 176BC51A20; Tue, 2 Aug 2022 10:59:45 -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 55D99B82011; Tue, 2 Aug 2022 17:59:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B6BC433B5; Tue, 2 Aug 2022 17:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659463183; bh=xpWA7Jpv8r6INPM8eC9dRH0bjB0EBSQdgOjBy0N4/rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V15liBSsJpZKesOb/8eDlMArbGuucPgpmrtWaDszI2rKEzxMbDCo0O95EcymiP/Gp hgvNMmLbm1E/ShJPRVRXIXi9EaBllYBTW3GEAjm718erwAGJskfqJORShJdSvPuNbQ iwAUvD2pCUmKfk3TcIc0HVHOG2CT8xYrYzkhhrOlRbyepLiKpGC5bezksL0I3N+KzC Jv4qtfYKy9y1e9icY9Kkg9JLXewDMZ4CEcfa1K++dF9fJD6y37IAJgFl4+f0I149YC edPUIBhg/MRDSCtYNChFU0UpEPNcFAl7jQ87XMhYIPr1NXSx95oRx15uf1S6GtFrhp 5GKo0/IDk4IgQ== From: Nathan Chancellor To: Thomas Bogendoerfer Cc: Nick Desaulniers , Tom Rix , "Maciej W. Rozycki" , torvalds@linux-foundation.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor , Sudip Mukherjee Subject: [PATCH] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Tue, 2 Aug 2022 10:59:36 -0700 Message-Id: <20220802175936.2278362-1-nathan@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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 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 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 --- 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 base-commit: 7d0d3fa7339ed5a06d6608b7cde9f079eba62bb1 -- 2.37.1