2019-01-08 05:47:14

by Yi Wang

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

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

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

Signed-off-by: huang.zijiang <[email protected]>
---
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



2019-01-08 13:32:40

by Borislav Petkov

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


> 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" <[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?

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