Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3414554rwa; Tue, 23 Aug 2022 04:30:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Pxfe1FHr9VIhWGatj5UpyKYnPAsD3zxv9Qgp5ucM7u+vNbrV9zfFPe8AiZrpnNzttCVyO X-Received: by 2002:a05:6402:10d2:b0:445:d9ee:fc19 with SMTP id p18-20020a05640210d200b00445d9eefc19mr3156548edu.81.1661254242897; Tue, 23 Aug 2022 04:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254242; cv=none; d=google.com; s=arc-20160816; b=rHizk0ezR2YhK9VNzM1m8Eze0y7WD56MiQzCC/Lq4OXGcmUq26zp1z7Z4w7A6UpoUB 9SJXAzkEP64rMR6lFf1sSSo2Y2Y7PxDKay6hZXTtdIAEPm8ze1o0vBqxzUAj6Awyx+pA LUmwrOFESST5y22aqdiTtaJdr9BU3p6EP6mKo0vx4Xs6jMFWQn2nrnbfXH188SrS+176 UNOHjeDBl1WZzFsthIJFp+6q83sit3XwGt3KyFhono1rakRiltg6XyPAw4anVLJxTfxF XdPYGD33KfwUYaBBWbMPzCbjLcbd9mEJOfDT1g+IahSlUdMS175DswWr6tlue67skA25 LqfQ== 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=/gGBBhKfrjp8aEfuvYNEpnkoIfXu1tX7vLPNe6H+zE0=; b=ijR6tqv7+liljYu/Oo0dJkzXuHm2Hd49e8C9ihZkgOsUYuW37IpKabGAM+Br2zZ3pG uFWPraRJ70TTEZ8KrmZnFt8NoutOU9UtVekgs+2JUF96iRaBwE1pfQC4lCAZWRIzPAUB io5O3cezqswAriV/TGSCF8zVaxwjpIt9ngq5BJ9Q35hXB+GxXLGvPwnidViLREvt4sEV GGCJi8H5+ESlOBE1SuhaxNXBBOd0Ladl2zb33Xc1EgH8RJNLgy11Njk4/zEXxtoilJ6V qWnNe0HhyuVIsY0iTod4B8H8mAD0+DR43XijHDXBFNB7RIYsFeJ9ka7ZKZBRRGJ4UNHG HwnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vJxOTUM+; 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 hr39-20020a1709073fa700b0073d635877ffsi529851ejc.478.2022.08.23.04.30.17; Tue, 23 Aug 2022 04:30:42 -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=vJxOTUM+; 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 S231491AbiHWLFX (ORCPT + 99 others); Tue, 23 Aug 2022 07:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356662AbiHWLDe (ORCPT ); Tue, 23 Aug 2022 07:03:34 -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 4D6B0B2866; Tue, 23 Aug 2022 02:15:10 -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 2CA6F61183; Tue, 23 Aug 2022 09:14:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A9D4C433C1; Tue, 23 Aug 2022 09:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246078; bh=0nBwYGTh2d6brre8QZyzFCu/z0haKKRiLE6m6lOqEck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJxOTUM+DXX7lXuNG/l59faCl13Ch52o3qNlgFm1p18nnju4DUfA4kdouUAVAOqz7 MyNqX3YQ8Z0fvyZZyM3Sp8pN6aJrUv9uR2x/bZG7nQHLO43+fGbUa7PNuCtkyhPOE1 F5OJcCdXYbBP+qga0GdCBTMFRe/R/ZCAswIvjeC0= 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.19 283/287] MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0 Date: Tue, 23 Aug 2022 10:27:32 +0200 Message-Id: <20220823080111.024459620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 620abc968624..a97b3e5a1c00 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c @@ -630,7 +630,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 { @@ -2559,7 +2559,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