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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 28 Jan 2017 23:11:59 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     linux-kernel@...r.kernel.org
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Andy Lutomirski <luto@...capital.net>,
        Borislav Petkov <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH 38/50] x86/boot/e820: Use 'enum e820_type' when handling the e820 region type

The E820 region type is put into four different types (!) when used in function
parameters or local variables:

	unsigned type;
	int type;
	unsigned long current_type;
	u32 type;

Use 'enum e820_type' in all these cases instead.

No change in functionality.

Cc: Alex Thorlton <athorlton@....com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Huang, Ying <ying.huang@...el.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Juergen Gross <jgross@...e.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Paul Jackson <pj@....com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Rafael J. Wysocki <rjw@...k.pl>
Cc: Tejun Heo <tj@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Wei Yang <richard.weiyang@...il.com>
Cc: Yinghai Lu <yinghai@...nel.org>
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/include/asm/e820/api.h | 10 +++++-----
 arch/x86/kernel/e820.c          | 22 +++++++++++-----------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h
index 465c32c9a0dc..4c35c36c62d5 100644
--- a/arch/x86/include/asm/e820/api.h
+++ b/arch/x86/include/asm/e820/api.h
@@ -8,12 +8,12 @@ extern struct e820_table *e820_table_firmware;
 
 extern unsigned long pci_mem_start;
 
-extern int  e820__mapped_any(u64 start, u64 end, unsigned type);
-extern int  e820__mapped_all(u64 start, u64 end, unsigned type);
+extern int  e820__mapped_any(u64 start, u64 end, enum e820_type type);
+extern int  e820__mapped_all(u64 start, u64 end, enum e820_type type);
 
-extern void e820__range_add   (u64 start, u64 size, int type);
-extern u64  e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type);
-extern u64  e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype);
+extern void e820__range_add   (u64 start, u64 size, enum e820_type type);
+extern u64  e820__range_update(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type);
+extern u64  e820__range_remove(u64 start, u64 size, enum e820_type old_type, int checktype);
 
 extern void e820__print_table(char *who);
 extern int  e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *pnr_map);
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 010a289ddd9f..79673843dc42 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(pci_mem_start);
  * This function checks if any part of the range <start,end> is mapped
  * with type.
  */
-int e820__mapped_any(u64 start, u64 end, unsigned type)
+int e820__mapped_any(u64 start, u64 end, enum e820_type type)
 {
 	int i;
 
@@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(e820__mapped_any);
  * Note: this function only works correctly once the E820 table is sorted and
  * not-overlapping (at least for the range specified), which is the case normally.
  */
-int __init e820__mapped_all(u64 start, u64 end, unsigned type)
+int __init e820__mapped_all(u64 start, u64 end, enum e820_type type)
 {
 	int i;
 
@@ -125,7 +125,7 @@ int __init e820__mapped_all(u64 start, u64 end, unsigned type)
 /*
  * Add a memory region to the kernel E820 map.
  */
-static void __init __e820__range_add(struct e820_table *table, u64 start, u64 size, int type)
+static void __init __e820__range_add(struct e820_table *table, u64 start, u64 size, enum e820_type type)
 {
 	int x = table->nr_entries;
 
@@ -140,12 +140,12 @@ static void __init __e820__range_add(struct e820_table *table, u64 start, u64 si
 	table->nr_entries++;
 }
 
-void __init e820__range_add(u64 start, u64 size, int type)
+void __init e820__range_add(u64 start, u64 size, enum e820_type type)
 {
 	__e820__range_add(e820_table, start, size, type);
 }
 
-static void __init e820_print_type(u32 type)
+static void __init e820_print_type(enum e820_type type)
 {
 	switch (type) {
 	case E820_RAM:			/* Fall through: */
@@ -265,7 +265,7 @@ int __init e820__update_table(struct e820_entry *biosmap, int max_nr_map, u32 *p
 	static struct change_member *change_point[2*E820_X_MAX] __initdata;
 	static struct e820_entry *overlap_list[E820_X_MAX] __initdata;
 	static struct e820_entry new_bios[E820_X_MAX] __initdata;
-	unsigned long current_type, last_type;
+	enum e820_type current_type, last_type;
 	unsigned long long last_addr;
 	int chgidx;
 	int overlap_entries;
@@ -407,7 +407,7 @@ static int __init append_e820_table(struct e820_entry *biosmap, int nr_map)
 }
 
 static u64 __init
-__e820__range_update(struct e820_table *table, u64 start, u64 size, unsigned old_type, unsigned new_type)
+__e820__range_update(struct e820_table *table, u64 start, u64 size, enum e820_type old_type, enum e820_type new_type)
 {
 	u64 end;
 	unsigned int i;
@@ -474,18 +474,18 @@ __e820__range_update(struct e820_table *table, u64 start, u64 size, unsigned old
 	return real_updated_size;
 }
 
-u64 __init e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type)
+u64 __init e820__range_update(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type)
 {
 	return __e820__range_update(e820_table, start, size, old_type, new_type);
 }
 
-static u64 __init e820__range_update_firmware(u64 start, u64 size, unsigned old_type, unsigned new_type)
+static u64 __init e820__range_update_firmware(u64 start, u64 size, enum e820_type old_type, enum e820_type  new_type)
 {
 	return __e820__range_update(e820_table_firmware, start, size, old_type, new_type);
 }
 
 /* Remove a range of memory from the E820 table: */
-u64 __init e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype)
+u64 __init e820__range_remove(u64 start, u64 size, enum e820_type old_type, int checktype)
 {
 	int i;
 	u64 end;
@@ -768,7 +768,7 @@ u64 __init e820__memblock_alloc_reserved(u64 size, u64 align)
 /*
  * Find the highest page frame number we have available
  */
-static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
+static unsigned long __init e820_end_pfn(unsigned long limit_pfn, enum e820_type type)
 {
 	int i;
 	unsigned long last_pfn = 0;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ