Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413384rwa; Tue, 23 Aug 2022 04:29:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR7nxPfD00EGMw2tvMM6sBRAlLCPnWt/juV3jMK++AHKnF/mc8OGz9D5vHZ/H07RBzPGP2F9 X-Received: by 2002:a05:6a00:1883:b0:536:e59f:f776 with SMTP id x3-20020a056a00188300b00536e59ff776mr4557832pfh.49.1661254179108; Tue, 23 Aug 2022 04:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254179; cv=none; d=google.com; s=arc-20160816; b=jM1tvmUvB5ZA/x+ZDuAW5vNxOb7WKF8WvQGB+Y30TdC6THEwON2itJMNQVPpK25Vnt c0dGL+KpyIaP7Xy/vvSNEMQGk1EIWG/EMeIdmm976Pb53ak3m299GF5yffVKc7V7fTs5 N2+BTzWUwzOe9ShQnZ/JL4NOhP9H/KxgdU5ee7n4rYg0ROsS0/k0uZojBdikiJ8bjjrI cms/i773XQc7mjCRCzybMCehBkhlfzYTFODva9hJoE2w7zby/rmMHCnSmUuP168yYnpP ehHdCOPZ3f56SLOR4XicNksCkQ57da6VJWGT8uxgZ480UxdLhWFiHxM5dDiJFS4uGYzy mIZA== 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=IvTvkzvjZuYcjHwnXA78edkjHfZa4ooc+umQhfY1JsI=; b=lGGdiBAR13GuIrXn0V7VYFNF713zx18RZnxvizazlf8jGV0XoKJRb9OLi/KYN0ILdW wFc5pppo4OVhiY78pSCHGjqKHg2WG48aaur/+6j3HBHoz4Sp71g4RGnWvACWYLHPaXu9 mVhhJKwOpBXdUZjMld7w4kXyM9+Ew6OmrRpKCtrJh7/ivdy/YjDTl0BTIRorE8JfqLRE 2ktcVFAGD+QTxGvox4Xp08jMcxjVNFSCxa87gkf6czMbYVOeYs3AmQDTCY2mLF1w94FR 7i8KVReJ1Sp3x087OB1/GShygTIGPaGMhORqNxKsGklTC4hKcUusNKPHQf/YGzP1Rtg8 +Iig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gAG7lYrZ; 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 z9-20020a63d009000000b00429cf28b83dsi15258182pgf.396.2022.08.23.04.29.25; Tue, 23 Aug 2022 04:29:39 -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=gAG7lYrZ; 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 S1355322AbiHWKXc (ORCPT + 99 others); Tue, 23 Aug 2022 06:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353458AbiHWKLa (ORCPT ); Tue, 23 Aug 2022 06:11:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC429B1CB; Tue, 23 Aug 2022 01:56:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 4273C61377; Tue, 23 Aug 2022 08:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5181CC433D6; Tue, 23 Aug 2022 08:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245008; bh=NQE+D1YIAmhEbIgHZMr35QDB/H8Pj1G4SuYfoV8s4vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAG7lYrZE7p1flRzjjlnwzSvv9gL+JB6XUJzlcOqIz43eCT/KxXS28YSvSZng3u0I b2IQGB2zh61b/FAnYm18F0PcQS+JJZv13ibMTdf8Bbbdq2uK4o3PNOFi6gfQqsP+Hs 1oWz9mtdHBeSW7tJV4WO0cc6+ulyo++sNjNgqNHQ= 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 4.14 229/229] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Tue, 23 Aug 2022 10:26:30 +0200 Message-Id: <20220823080101.806263541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 b55c74a7f7a4..82cd14e7b20d 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 { @@ -2577,7 +2577,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