aboutsummaryrefslogtreecommitdiffstats
diff options
authorIngo Molnar <mingo@kernel.org>2025-05-15 13:26:46 +0200
committerIngo Molnar <mingo@kernel.org>2025-05-15 13:44:04 +0200
commitad31bfec81afcbafc314165061ecb6ebfff56c3d (patch)
tree4c7e17b0fda562c6448f1d74a737f690f4f726cf
parent3365d6c8ce87947af61b6260bd16e43798876bee (diff)
downloadtip-WIP.x86/e820.tar.gz
x86/boot/e820: Move index increments outside accessors in e820__update_table()WIP.x86/e820
This kind of code: change_point[chg_idx++]->entry = &entries[idx]; Can be a bit confusing to human readers, and GCC-15 started warning about these patterns. Move the index increment outside the accessor. Suggested-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Arnd Bergmann <arnd@kernel.org> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
-rw-r--r--arch/x86/kernel/e820.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 10c6e7dc72d7e1..afb312620c82e9 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -421,9 +421,11 @@ __init int e820__update_table(struct e820_table *table)
for (idx = 0; idx < table->nr_entries; idx++) {
if (entries[idx].size != 0) {
change_point[chg_idx]->addr = entries[idx].addr;
- change_point[chg_idx++]->entry = &entries[idx];
+ change_point[chg_idx]->entry = &entries[idx];
+ chg_idx++;
change_point[chg_idx]->addr = entries[idx].addr + entries[idx].size;
- change_point[chg_idx++]->entry = &entries[idx];
+ change_point[chg_idx]->entry = &entries[idx];
+ chg_idx++;
}
}
chg_nr = chg_idx;