Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11786609pjo; Thu, 2 Jan 2020 14:16:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzsYotHDPQKsRKJg4roiONA2NfKCx+Gf72dmR8RM8meox5HBnwW0zAIMFgGXsBEdcmI6YlQ X-Received: by 2002:a9d:588d:: with SMTP id x13mr89556432otg.6.1578003361121; Thu, 02 Jan 2020 14:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003361; cv=none; d=google.com; s=arc-20160816; b=WwkQs+VCtQIliP1cjdX9/a8kE3fNcEPHsBIJxsdOLiEVkrpGQpSqfL83XzVw7W9f+2 qrv7qrRGfbEvR439OWLF1Rbid3rCHZfDCTpGmMb/PD9+Sk7VT+Wp0KZo19OY8OUfXS+B NyaPXUc6p7sNh3GdhhFVMmkG3Vi979eO55TktWgkVYMOKO68qRl6KnQ26Ss/lTqbJf6J +rs59onmeTAXW+HlYBzaFgXYTmW5FmrbYTn22Zo1l6Id2LkzbDTbLplk3HQsc/KDdJRj C7BOxbvqHuz3vTRH/48SmnhldXCTyMzh9uPJ1PGiKlgkOuZkcBv5BBQ1XqmoQVuvbZO0 3g7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nCtab86ET5F51FKSkt7lY9EtRtNbcG6WHD7Aumzuacw=; b=jLL+eTxK2gbj0b2g4fhsPS7EpNzObMBbdirtjg+peUolTglLQWmCWL6meE/eoIyinZ A1RzN2bY5qa975aMMeo/ZDxbG6cSIFFn3JIWTg0EW0LZN6S2oVz600FVYn/Fq/QqJpJq KNYS8II3G/zP9uL3LpyvWHU+I/j251NMz3ggURpGH7uCjc2FMhhBKrXGSgC8fCEUYAy8 p1bMQLnj+2rW1cg61l4d6Co23b96MnvgNeb3n8jTPSDQE+qo87k0rl6B9NARnO8qIuN6 sRWrwXSQ0/3HVBxNXBhdJK8xOykDXu0ZkCI+4xyRcbP99buW5z1/iKjj6zUE30OgemkG gO8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R4KxmqRG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si27479154oig.155.2020.01.02.14.15.48; Thu, 02 Jan 2020 14:16:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R4KxmqRG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbgABWOm (ORCPT + 99 others); Thu, 2 Jan 2020 17:14:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:54972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727937AbgABWOi (ORCPT ); Thu, 2 Jan 2020 17:14:38 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 750D121D7D; Thu, 2 Jan 2020 22:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003277; bh=y39XHn13WKrb3P2w/HCNKsTKr5QrxtrqjPkgUGvJwbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4KxmqRGmAw4aPgAHyZhawTxSKNC8n0tvTFBTLt4sl/9VBg2FUO3bV3kkBcNTKluz y4jXiO/YlXJiHCm/+G9dJscX8gsY2OZdep9R37fZUO+QTohLpW4WHpQOHeyb3ndJ+r B4j2BHxCTBAJyic9cDzQp97AUSOXrvibVbwQsokA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 086/191] powerpc/fixmap: Use __fix_to_virt() instead of fix_to_virt() Date: Thu, 2 Jan 2020 23:06:08 +0100 Message-Id: <20200102215839.149918121@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit 77693a5fb57be4606a6024ec8e3076f9499b906b ] Modify back __set_fixmap() to using __fix_to_virt() instead of fix_to_virt() otherwise the following happens because it seems GCC doesn't see idx as a builtin const. CC mm/early_ioremap.o In file included from ./include/linux/kernel.h:11:0, from mm/early_ioremap.c:11: In function ‘fix_to_virt’, inlined from ‘__set_fixmap’ at ./arch/powerpc/include/asm/fixmap.h:87:2, inlined from ‘__early_ioremap’ at mm/early_ioremap.c:156:4: ./include/linux/compiler.h:350:38: error: call to ‘__compiletime_assert_32’ declared with attribute error: BUILD_BUG_ON failed: idx >= __end_of_fixed_addresses _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ ./include/linux/compiler.h:331:4: note: in definition of macro ‘__compiletime_assert’ prefix ## suffix(); \ ^ ./include/linux/compiler.h:350:2: note: in expansion of macro ‘_compiletime_assert’ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ ./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ ./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^ ./include/asm-generic/fixmap.h:32:2: note: in expansion of macro ‘BUILD_BUG_ON’ BUILD_BUG_ON(idx >= __end_of_fixed_addresses); ^ Signed-off-by: Christophe Leroy Fixes: 4cfac2f9c7f1 ("powerpc/mm: Simplify __set_fixmap()") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/f4984c615f90caa3277775a68849afeea846850d.1568295907.git.christophe.leroy@c-s.fr Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/fixmap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h index 0cfc365d814b..722289a1d000 100644 --- a/arch/powerpc/include/asm/fixmap.h +++ b/arch/powerpc/include/asm/fixmap.h @@ -77,7 +77,12 @@ enum fixed_addresses { static inline void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) { - map_kernel_page(fix_to_virt(idx), phys, flags); + if (__builtin_constant_p(idx)) + BUILD_BUG_ON(idx >= __end_of_fixed_addresses); + else if (WARN_ON(idx >= __end_of_fixed_addresses)) + return; + + map_kernel_page(__fix_to_virt(idx), phys, flags); } #endif /* !__ASSEMBLY__ */ -- 2.20.1