x86/pat: Guard within_inclusive() with ifdeffery
PATCH 1/1 x86/pat: Guard within_inclusive() with ifdeffery
The within_inclusive() in some cases, when CONFIG_X86_64=n, may be not used. This, in particular, prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
arch/x86/mm/pat/set_memory.c:215:1: error: unused function 'within_inclusive' [-Werror,-Wunused-function]
Fix this by guarding the definitions with the respective ifdeffery.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").
--- arch/x86/mm/pat/set_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/pat/set_memory.c +2 -2
@@ -211,14 +211,14 @@ within(unsigned long addr, unsigned long start, unsigned long end)return addr >= start && addr < end; } +#ifdef CONFIG_X86_64 +static inline int within_inclusive (unsigned long addr,unsigned long start,unsigned long end) {return addr >= start && addr <= end; } -#ifdef CONFIG_X86_64 -/* * The kernel image is mapped into two places in the virtual address space * (addresses without KASLR, of course):
Signature · 1 line
2.45.1.3035.g276e886db78b
[tip: x86/mm] x86/pat: Fix W=1 build warning when the within_inclusive() function is unused
The following commit has been merged into the x86/mm branch of tip:
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 3fcae7771fb724c276e87e80827b264d2c3ad67e Gitweb: https://git.kernel.org/tip/3fcae7771fb724c276e87e80827b264d2c3ad67e Author: Andy Shevchenko <[email protected]> AuthorDate: Tue, 11 Feb 2025 16:57:21 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Fri, 21 Feb 2025 16:35:49 +01:00
x86/pat: Fix W=1 build warning when the within_inclusive() function is unused
The within_inclusive() function, in some cases, when CONFIG_X86_64=n, may be not used.
This, in particular, prevents kernel builds with Clang, make W=1 and CONFIG_WERROR=y:
arch/x86/mm/pat/set_memory.c:215:1: error: unused function 'within_inclusive' [-Werror,-Wunused-function]
Fix this by guarding the definitions with the respective ifdeffery.
See also:
6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")
--- arch/x86/mm/pat/set_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/pat/set_memory.c +2 -2
@@ -225,14 +225,14 @@ within(unsigned long addr, unsigned long start, unsigned long end)return addr >= start && addr < end; } +#ifdef CONFIG_X86_64 +static inline int within_inclusive (unsigned long addr,unsigned long start,unsigned long end) {return addr >= start && addr <= end; } -#ifdef CONFIG_X86_64 -/* * The kernel image is mapped into two places in the virtual address space * (addresses without KASLR, of course):