mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Huang Zijiang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: rppt@linux.vnet.ibm.com, m.mizuma@jp.fujitsu.com,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	n-horiguchi@ah.jp.nec.com, hpa@zytor.com,
	huang.zijiang@zte.com.cn, bp@suse.de, mhocko@suse.com,
	joe@perches.com, x86@kernel.org, tglx@linutronix.de,
	akpm@linux-foundation.org, mingo@redhat.com
Subject: [tip:x86/cleanups] x86/e820: Replace kmalloc() + memcpy() with kmemdup()
Date: Sun, 13 Jan 2019 06:21:55 -0800	[thread overview]
Message-ID: <tip-345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91@git.kernel.org> (raw)
In-Reply-To: <1547277384-22156-1-git-send-email-wang.yi59@zte.com.cn>

Commit-ID:  345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91
Gitweb:     https://git.kernel.org/tip/345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91
Author:     Huang Zijiang <huang.zijiang@zte.com.cn>
AuthorDate: Sat, 12 Jan 2019 15:16:24 +0800
Committer:  Borislav Petkov <bp@suse.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@zte.com.cn>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: jschoenh@amazon.de
Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Cc: xue.zhihong@zte.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;
 }
 

      reply	other threads:[~2019-01-13 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12  7:16 [PATCH v2] x86/boot/e820: Use kmemdup instead of duplicating its function Yi Wang
2019-01-13 14:21 ` tip-bot for Huang Zijiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-345dca4ca7e65a46bf0b6e2e6b8ab2e998ec6e91@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=huang.zijiang@zte.com.cn \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=m.mizuma@jp.fujitsu.com \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome