Re: [GIT PULL] microcode loader updates
From: Borislav Petkov
Date: Mon Mar 02 2015 - 10:05:42 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/