From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754876AbbCBPFk (ORCPT ); Mon, 2 Mar 2015 10:05:40 -0500 Received: from mail.skyhub.de ([78.46.96.112]:48648 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbbCBPFi (ORCPT ); Mon, 2 Mar 2015 10:05:38 -0500 Date: Mon, 2 Mar 2015 16:04:28 +0100 From: Borislav Petkov To: Quentin Casasnovas Cc: x86-ml , lkml Subject: Re: [GIT PULL] microcode loader updates Message-ID: <20150302150428.GD17521@pd.tnic> References: <20150302123441.GB17521@pd.tnic> <20150302130336.GB14850@chrystal.home> <20150302132950.GC17521@pd.tnic> <20150302134212.GC14850@chrystal.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150302134212.GC14850@chrystal.home> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2015 at 02:42:12PM +0100, Quentin Casasnovas wrote: > It's just that this potential-but-very-very-likely-impossible kfree() on > garbage wasn't present in the original code - so I thought changing the > kmalloc() => kcalloc() was small enough to add in your serie. I'd also be > fine removing the early loop termination condition if you think it's dead > code since that'll make sure this will never happen. A static analyzer or > maybe some cocinnelle semantic patches are likely to start complaining > about this otherwise, I think. Ok, ok, you got me persuaded. --- diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c index 3fd583b4f576..2f49ab4ac0ae 100644 --- a/arch/x86/kernel/cpu/microcode/intel_early.c +++ b/arch/x86/kernel/cpu/microcode/intel_early.c @@ -189,8 +189,7 @@ save_microcode(struct mc_saved_data *mc_saved_data, /* * Copy new microcode data. */ - saved_ptr = kmalloc(mc_saved_count * sizeof(struct microcode_intel *), - GFP_KERNEL); + saved_ptr = kcalloc(mc_saved_count, sizeof(struct microcode_intel *), GFP_KERNEL); if (!saved_ptr) return -ENOMEM; -- Better? :-) -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --