Skip to contentSkip to conversation

x86:kernel:e820c:kmemdup instead of duplicating its function

PATCH In review Yi Wang 2 participants 2 messages Jan 8, 2019 x86

lore
Share & tools
lore

Yi Wang

author
#0 lore raw

PATCH 1/1 x86:kernel:e820c:kmemdup instead of duplicating its function

From: "huang.zijiang" <[email protected]>

kmemdup has implemented the function that kmalloc() and memcpy().

---
 arch/x86/kernel/e820.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/x86/kernel/e820.c +3 -6
index 50895c2..a687d10 100644
@@ -671,21 +671,18 @@ __init void e820__reallocate_tables(void)
 	int size;
 
 	size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table->nr_entries;
-	n = kmalloc(size, GFP_KERNEL);
+	n = kmemdup(e820_table, size, GFP_KERNEL);
 	BUG_ON(!n);
-	memcpy(n, e820_table, size);
 	e820_table = n;
 
 	size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_kexec->nr_entries;
-	n = kmalloc(size, GFP_KERNEL);
+	n = kmemdup(e820_table_kexec, size, GFP_KERNEL);
 	BUG_ON(!n);
-	memcpy(n, e820_table_kexec, size);
 	e820_table_kexec = n;
 
 	size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_firmware->nr_entries;
-	n = kmalloc(size, GFP_KERNEL);
+	n = kmemdup(e820_table_firmware, size, GFP_KERNEL);
 	BUG_ON(!n);
-	memcpy(n, e820_table_firmware, size);
 	e820_table_firmware = n;
 }
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 2 lines

Subject: Re: [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function

The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use file names or complete file paths as prefix. 'git log path/to/file' should give you a reasonable hint in most cases.

The condensed patch description in the subject line should start with a uppercase letter and should be written in imperative tone.

Quoted 1 line · Yi Wang

From: "huang.zijiang" <[email protected]>

	^^^^^^^^^^^^^^

I'm guessing your name is "Huang Zijiang" and you'd like to have it this way in git history, instead with small letters and with a dot inbetween?

Quoted 1 line

kmemdup has implemented the function that kmalloc() and memcpy().

This is not a correct english sentence. Please try again.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.