lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Mar 2015 16:04:28 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Quentin Casasnovas <quentin.casasnovas@...cle.com>
Cc:	x86-ml <x86@...nel.org>, lkml <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] microcode loader updates

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.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists