lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 28 Mar 2024 02:28:29 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: tglx@...utronix.de,
	mingo@...hat.com,
	bp@...en8.de
Cc: x86@...nel.org,
	linux-kernel@...r.kernel.org,
	Wei Yang <richard.weiyang@...il.com>
Subject: [PATCH 1/2] x86/boot/e820: not necessary to iterate whole overlap_list

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

Signed-off-by: Wei Yang <richard.weiyang@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ