From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759811AbdAEBtd convert rfc822-to-8bit (ORCPT ); Wed, 4 Jan 2017 20:49:33 -0500 Received: from TYO200.gate.nec.co.jp ([210.143.35.50]:57116 "EHLO tyo200.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750920AbdAEBta (ORCPT ); Wed, 4 Jan 2017 20:49:30 -0500 X-Greylist: delayed 2762 seconds by postgrey-1.27 at vger.kernel.org; Wed, 04 Jan 2017 20:49:30 EST From: Junichi Nomura To: "bp@alien8.de" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" CC: "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" Subject: [PATCH] x86/microcode/intel: Fix allocation size of struct ucode_patch Thread-Topic: [PATCH] x86/microcode/intel: Fix allocation size of struct ucode_patch Thread-Index: AQHSZu+U/l1IZb2FmEOpgrKPMNh7bQ== Date: Thu, 5 Jan 2017 01:03:51 +0000 Message-ID: <7a730dc9-ac17-35c4-fe76-dfc94e5ecd95@ce.jp.nec.com> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.34.125.85] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <5550350AC0140847B467E065D0FD0DA7@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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.