linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function
@ 2019-01-08  5:42 Yi Wang
  2019-01-08 13:30 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Yi Wang @ 2019-01-08  5:42 UTC (permalink / raw)
  To: tglx
  Cc: mingo, bp, hpa, x86, akpm, rppt, mhocko, pavel.tatashin, joe,
	jschoenh, m.mizuma, n-horiguchi, linux-kernel, xue.zhihong,
	wang.yi59, huang.zijiang

From: "huang.zijiang" <huang.zijiang@zte.com.cn>

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

Signed-off-by: huang.zijiang <huang.zijiang@zte.com.cn>
---
 arch/x86/kernel/e820.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 50895c2..a687d10 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -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;
 }
 
-- 
1.8.3.1


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

* Re: [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function
  2019-01-08  5:42 [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function Yi Wang
@ 2019-01-08 13:30 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2019-01-08 13:30 UTC (permalink / raw)
  To: Yi Wang
  Cc: tglx, mingo, hpa, x86, akpm, rppt, mhocko, pavel.tatashin, joe,
	jschoenh, m.mizuma, n-horiguchi, linux-kernel, xue.zhihong,
	huang.zijiang


> 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.

On Tue, Jan 08, 2019 at 01:42:17PM +0800, Yi Wang wrote:
> From: "huang.zijiang" <huang.zijiang@zte.com.cn>
	^^^^^^^^^^^^^^

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?

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

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

-- 
Regards/Gruss,
    Boris.

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

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

end of thread, other threads:[~2019-01-08 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08  5:42 [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function Yi Wang
2019-01-08 13:30 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).