linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/microcode/intel: Fix allocation size of struct ucode_patch
@ 2017-01-05  1:03 Junichi Nomura
  2017-01-05 10:23 ` Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Junichi Nomura @ 2017-01-05  1:03 UTC (permalink / raw)
  To: bp, x86, linux-kernel; +Cc: tglx, mingo, hpa

We allocate struct ucode_patch here.

"size" is a size of microcode data and used for kmemdup() later
in this function.

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Fixes: 06b8534cb728 ("x86/microcode: Rework microcode loading")

diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index aee3cb5..042f329 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -150,7 +150,7 @@ static struct ucode_patch *__alloc_microcode_buf(void *data, unsigned int size)
 {
 	struct ucode_patch *p;
 
-	p = kzalloc(size, GFP_KERNEL);
+	p = kzalloc(sizeof(struct ucode_patch), GFP_KERNEL);
 	if (!p)
 		return ERR_PTR(-ENOMEM);
 
-- 
Jun'ichi Nomura, NEC Corporation / NEC Solution Innovators, Ltd.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-01-09 22:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-05  1:03 [PATCH] x86/microcode/intel: Fix allocation size of struct ucode_patch Junichi Nomura
2017-01-05 10:23 ` Borislav Petkov
2017-01-05 17:44 ` Andy Shevchenko
2017-01-05 23:52   ` Junichi Nomura
2017-01-06  0:02     ` Borislav Petkov
2017-01-06  0:14       ` Junichi Nomura
2017-01-06 10:56         ` Borislav Petkov
2017-01-09 22:17 ` [tip:x86/urgent] " tip-bot for Junichi Nomura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).