mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/boot/e820: not necessary to iterate whole overlap_list
@ 2024-03-28  2:28 Wei Yang
  2024-03-28  2:28 ` [PATCH 2/2] x86/boot/e820: a local variable for last_addr is not necessary Wei Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2024-03-28  2:28 UTC (permalink / raw)
  To: tglx, mingo, bp; +Cc: x86, linux-kernel, Wei Yang

We are sure there is only one entry to be removed from overlap_list.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 arch/x86/kernel/e820.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 6f1b379e3b38..ecbeb76ed08f 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -377,10 +377,11 @@ int __init e820__update_table(struct e820_table *table)
 		} else {
 			/* Remove entry from list (order independent, so swap with last): */
 			for (i = 0; i < overlap_entries; i++) {
-				if (overlap_list[i] == change_point[chg_idx]->entry)
-					overlap_list[i] = overlap_list[overlap_entries-1];
+				if (overlap_list[i] == change_point[chg_idx]->entry) {
+					overlap_list[i] = overlap_list[--overlap_entries];
+					break;
+				}
 			}
-			overlap_entries--;
 		}
 		/*
 		 * If there are overlapping entries, decide which
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28  2:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28  2:28 [PATCH 1/2] x86/boot/e820: not necessary to iterate whole overlap_list Wei Yang
2024-03-28  2:28 ` [PATCH 2/2] x86/boot/e820: a local variable for last_addr is not necessary Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®