[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <174125602814.14745.12946945836213678532.tip-bot2@tip-bot2>
Date: Thu, 06 Mar 2025 10:13:48 -0000
From: "tip-bot2 for Andy Shevchenko" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: kernel test robot <lkp@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/mm] x86/mm: Check if PTRS_PER_PMD is defined before use
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 74a6c5103f8c27df056227e9e3bfe1ffeb7fc3f3
Gitweb: https://git.kernel.org/tip/74a6c5103f8c27df056227e9e3bfe1ffeb7fc3f3
Author: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
AuthorDate: Thu, 06 Mar 2025 11:25:41 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Thu, 06 Mar 2025 11:03:59 +01:00
x86/mm: Check if PTRS_PER_PMD is defined before use
Compiler (GCC) is not happy about PTRS_PER_PMD being undefined
(note, clang also issues the quite similar warning):
In file included from arch/x86/kernel/head_32.S:29:
arch/x86/include/asm/pgtable_32.h:59:5: error: "PTRS_PER_PMD" is not defined, evaluates to 0 [-Werror=undef]
59 | #if PTRS_PER_PMD > 1
Add a check to make sure PTRS_PER_PMD is defined before use.
The documentation for GCC 7.5.0+ says that:
if defined BUFSIZE && BUFSIZE >= 1024
can generally be simplified to just #if BUFSIZE >= 1024, since if BUFSIZE
is not defined, it will be interpreted as having the value zero.
But in the same time the last paragraph points out that
It will warn wherever your code uses this feature.
which is what we met here.
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Link: https://lore.kernel.org/r/20250306092658.378837-1-andriy.shevchenko@linux.intel.com
Closes: https://lore.kernel.org/r/202412152358.l9RJiVaH-lkp@intel.com/
---
arch/x86/include/asm/pgtable_32.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
index 7d4ad89..3c05235 100644
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -56,7 +56,7 @@ do { \
* With PAE paging (PTRS_PER_PMD > 1), we allocate PTRS_PER_PGD == 4 pages for
* the PMD's in addition to the pages required for the last level pagetables.
*/
-#if PTRS_PER_PMD > 1
+#if defined(PTRS_PER_PMD) && (PTRS_PER_PMD > 1)
#define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD)
#else
#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD)
Powered by blists - more mailing lists