[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250421185210.3372306-15-mingo@kernel.org>
Date: Mon, 21 Apr 2025 20:51:54 +0200
From: Ingo Molnar <mingo@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andy@...nel.org>,
Arnd Bergmann <arnd@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Juergen Gross <jgross@...e.com>,
"H . Peter Anvin" <hpa@...or.com>,
Kees Cook <keescook@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mike Rapoport <rppt@...nel.org>,
Paul Menzel <pmenzel@...gen.mpg.de>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
David Woodhouse <dwmw@...zon.co.uk>
Subject: [PATCH 14/29] x86/boot/e820: Clean up __e820__range_add() a bit
- Use 'idx' index variable instead of a weird 'x'
- Make the error message E820-specific
- Group the code a bit better
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Andy Shevchenko <andy@...nel.org>
Cc: Arnd Bergmann <arnd@...nel.org>
Cc: David Woodhouse <dwmw@...zon.co.uk>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Kees Cook <keescook@...omium.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Mike Rapoport (Microsoft) <rppt@...nel.org>
---
arch/x86/kernel/e820.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index ae05161896d4..6e626c4a3817 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -165,17 +165,18 @@ int e820__get_entry_type(u64 start, u64 end)
*/
static void __init __e820__range_add(struct e820_table *table, u64 start, u64 size, enum e820_type type)
{
- int x = table->nr_entries;
+ int idx = table->nr_entries;
- if (x >= ARRAY_SIZE(table->entries)) {
- pr_err("too many entries; ignoring [mem %#010llx-%#010llx]\n",
- start, start + size - 1);
+ if (idx >= ARRAY_SIZE(table->entries)) {
+ pr_err("too many E820 table entries; ignoring [mem %#010llx-%#010llx]\n",
+ start, start + size-1);
return;
}
- table->entries[x].addr = start;
- table->entries[x].size = size;
- table->entries[x].type = type;
+ table->entries[idx].addr = start;
+ table->entries[idx].size = size;
+ table->entries[idx].type = type;
+
table->nr_entries++;
}
--
2.45.2
Powered by blists - more mailing lists