From: tip-bot for Andrzej Hajda <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: m.szyprowski@samsung.com, mingo@kernel.org,
b.zolnierkie@samsung.com, tglx@linutronix.de, bp@suse.de,
hpa@zytor.com, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org, a.hajda@samsung.com,
peterz@infradead.org
Subject: [tip:x86/microcode] x86/microcode: Use kmemdup() rather than duplicating its implementation
Date: Sat, 22 Aug 2015 06:58:15 -0700 [thread overview]
Message-ID: <tip-d4e963644768b33aa3db7f470c35d74ed78d8354@git.kernel.org> (raw)
In-Reply-To: <1439201994-28067-2-git-send-email-bp@alien8.de>
Commit-ID: d4e963644768b33aa3db7f470c35d74ed78d8354
Gitweb: http://git.kernel.org/tip/d4e963644768b33aa3db7f470c35d74ed78d8354
Author: Andrzej Hajda <a.hajda@samsung.com>
AuthorDate: Mon, 10 Aug 2015 12:19:52 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 22 Aug 2015 14:49:35 +0200
x86/microcode: Use kmemdup() rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1439201994-28067-2-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/microcode/amd.c | 4 +---
arch/x86/kernel/cpu/microcode/intel_early.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index c7d2415..be37f10 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -366,15 +366,13 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover)
return -EINVAL;
}
- patch->data = kzalloc(patch_size, GFP_KERNEL);
+ patch->data = kmemdup(fw + SECTION_HDR_SIZE, patch_size, GFP_KERNEL);
if (!patch->data) {
pr_err("Patch data allocation failure.\n");
kfree(patch);
return -EINVAL;
}
- /* All looks ok, copy patch... */
- memcpy(patch->data, fw + SECTION_HDR_SIZE, patch_size);
INIT_LIST_HEAD(&patch->plist);
patch->patch_id = mc_hdr->patch_id;
patch->equiv_cpu = proc_id;
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c
index 8187b72..101f0ac 100644
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -207,13 +207,11 @@ save_microcode(struct mc_saved_data *mc_saved_data,
mc_hdr = &mc->hdr;
size = get_totalsize(mc_hdr);
- saved_ptr[i] = kmalloc(size, GFP_KERNEL);
+ saved_ptr[i] = kmemdup(mc, size, GFP_KERNEL);
if (!saved_ptr[i]) {
ret = -ENOMEM;
goto err;
}
-
- memcpy(saved_ptr[i], mc, size);
}
/*
next prev parent reply other threads:[~2015-08-22 13:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 10:19 [PATCH 0/3] tip-queue 2015-08-10 Borislav Petkov
2015-08-10 10:19 ` [PATCH 1/3] x86/microcode: Use kmemdup() rather than duplicating its implementation Borislav Petkov
2015-08-22 13:58 ` tip-bot for Andrzej Hajda [this message]
2015-08-10 10:19 ` [PATCH 2/3] x86/asm: Add MONITORX/MWAITX insns support Borislav Petkov
2015-08-22 13:58 ` [tip:x86/asm] x86/asm: Add MONITORX/MWAITX instruction support tip-bot for Huang Rui
2015-08-10 10:19 ` [PATCH 3/3] x86/asm: Introduce an MWAITX-based delay with a configurable timer Borislav Petkov
2015-08-22 13:58 ` [tip:x86/asm] x86/asm/delay: " tip-bot for Huang Rui
-- strict thread matches above, loose matches on Subject: below --
2016-02-16 8:43 [PATCH 2/4] x86/microcode: Use kmemdup() rather than duplicating its implementation Borislav Petkov
2016-02-17 12:12 ` [tip:x86/microcode] " tip-bot for Andrzej Hajda
2015-08-05 3:18 [PATCH v6 0/2] x86, mwaitt: introduce AMD mwaitt support Huang Rui
2015-08-05 3:18 ` [PATCH v6 1/2] x86, mwaitt: add monitorx and mwaitx instruction Huang Rui
2015-08-05 3:18 ` [PATCH v6 2/2] x86, mwaitt: introduce mwaitx delay with a configurable timer Huang Rui
2015-08-06 15:14 ` Borislav Petkov
2015-08-07 4:46 ` Huang Rui
2015-08-05 4:01 ` [PATCH v6 0/2] x86, mwaitt: introduce AMD mwaitt support Borislav Petkov
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-d4e963644768b33aa3db7f470c35d74ed78d8354@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.hajda@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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