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-prev] [day] [month] [year] [list]
Message-Id: <20240328022830.22802-2-richard.weiyang@gmail.com>
Date: Thu, 28 Mar 2024 02:28:30 +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 2/2] x86/boot/e820: a local variable for last_addr is not necessary

We only use this to calculate the size of new entry as the start
address, which is already stored in new_entries->addr.

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

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index ecbeb76ed08f..8d431ac3f76e 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -324,7 +324,6 @@ int __init e820__update_table(struct e820_table *table)
 	struct e820_entry *entries = table->entries;
 	u32 max_nr_entries = ARRAY_SIZE(table->entries);
 	enum e820_type current_type, last_type;
-	unsigned long long last_addr;
 	u32 new_nr_entries, overlap_entries;
 	u32 i, chg_idx, chg_nr;
 
@@ -366,7 +365,6 @@ int __init e820__update_table(struct e820_table *table)
 	overlap_entries = 0;	 /* Number of entries in the overlap table */
 	new_nr_entries = 0;	 /* Index for creating new map entries */
 	last_type = 0;		 /* Start with undefined memory type */
-	last_addr = 0;		 /* Start with 0 as last starting address */
 
 	/* Loop through change-points, determining effect on the new map: */
 	for (chg_idx = 0; chg_idx < chg_nr; chg_idx++) {
@@ -397,7 +395,8 @@ int __init e820__update_table(struct e820_table *table)
 		/* Continue building up new map based on this information: */
 		if (current_type != last_type || e820_nomerge(current_type)) {
 			if (last_type) {
-				new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;
+				new_entries[new_nr_entries].size =
+					change_point[chg_idx]->addr - new_entries[new_nr_entries].addr;
 				/* Move forward only if the new size was non-zero: */
 				if (new_entries[new_nr_entries].size != 0)
 					/* No more space left for new entries? */
@@ -407,7 +406,6 @@ int __init e820__update_table(struct e820_table *table)
 			if (current_type) {
 				new_entries[new_nr_entries].addr = change_point[chg_idx]->addr;
 				new_entries[new_nr_entries].type = current_type;
-				last_addr = change_point[chg_idx]->addr;
 			}
 			last_type = current_type;
 		}
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ