[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1546926137-32136-1-git-send-email-wang.yi59@zte.com.cn>
Date: Tue, 8 Jan 2019 13:42:17 +0800
From: Yi Wang <wang.yi59@....com.cn>
To: tglx@...utronix.de
Cc: mingo@...hat.com, bp@...en8.de, hpa@...or.com, x86@...nel.org,
akpm@...ux-foundation.org, rppt@...ux.vnet.ibm.com,
mhocko@...e.com, pavel.tatashin@...rosoft.com, joe@...ches.com,
jschoenh@...zon.de, m.mizuma@...fujitsu.com,
n-horiguchi@...jp.nec.com, linux-kernel@...r.kernel.org,
xue.zhihong@....com.cn, wang.yi59@....com.cn,
"huang.zijiang" <huang.zijiang@....com.cn>
Subject: [PATCH] x86:kernel:e820c:kmemdup instead of duplicating its function
From: "huang.zijiang" <huang.zijiang@....com.cn>
kmemdup has implemented the function that kmalloc() and memcpy().
Signed-off-by: huang.zijiang <huang.zijiang@....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
Powered by blists - more mailing lists