public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: x86-ml <x86@kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] microcode loader updates
Date: Mon, 2 Mar 2015 16:04:28 +0100	[thread overview]
Message-ID: <20150302150428.GD17521@pd.tnic> (raw)
In-Reply-To: <20150302134212.GC14850@chrystal.home>

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.
--

  reply	other threads:[~2015-03-02 15:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 12:34 [GIT PULL] microcode loader updates Borislav Petkov
2015-03-02 13:03 ` Quentin Casasnovas
2015-03-02 13:29   ` Borislav Petkov
2015-03-02 13:42     ` Quentin Casasnovas
2015-03-02 15:04       ` Borislav Petkov [this message]
2015-03-02 15:29         ` Quentin Casasnovas
2015-03-02 17:48 ` Borislav Petkov
2015-03-03 12:55 ` Ingo Molnar

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=20150302150428.GD17521@pd.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.casasnovas@oracle.com \
    --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