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] [day] [month] [year] [list]
Date:   Sun, 13 Jan 2019 06:21:55 -0800
From:   tip-bot for Huang Zijiang <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     rppt@...ux.vnet.ibm.com, m.mizuma@...fujitsu.com,
        linux-kernel@...r.kernel.org, mingo@...nel.org,
        n-horiguchi@...jp.nec.com, hpa@...or.com, huang.zijiang@....com.cn,
        bp@...e.de, mhocko@...e.com, joe@...ches.com, x86@...nel.org,
        tglx@...utronix.de, akpm@...ux-foundation.org, mingo@...hat.com
Subject: [tip:x86/cleanups] x86/e820: Replace kmalloc() + memcpy() with
 kmemdup()

Commit-ID:  345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91
Gitweb:     https://git.kernel.org/tip/345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91
Author:     Huang Zijiang <huang.zijiang@....com.cn>
AuthorDate: Sat, 12 Jan 2019 15:16:24 +0800
Committer:  Borislav Petkov <bp@...e.de>
CommitDate: Sun, 13 Jan 2019 15:11:35 +0100

x86/e820: Replace kmalloc() + memcpy() with kmemdup()

Use the equivalent kmemdup() directly instead of kmalloc() + memcpy().

No functional changes.

 [ bp: rewrite commit message. ]

Signed-off-by: Huang Zijiang <huang.zijiang@....com.cn>
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Joe Perches <joe@...ches.com>
Cc: jschoenh@...zon.de
Cc: Masayoshi Mizuma <m.mizuma@...fujitsu.com>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Mike Rapoport <rppt@...ux.vnet.ibm.com>
Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: x86-ml <x86@...nel.org>
Cc: xue.zhihong@....com.cn
Link: https://lkml.kernel.org/r/1547277384-22156-1-git-send-email-wang.yi59@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 50895c2f937d..a687d10da417 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;
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ