Re: [PATCH 7/8] x86, microcode, intel: guard against misaligned microcode data

From: Borislav Petkov
Date: Wed Nov 12 2014 - 07:31:27 EST


On Tue, Nov 11, 2014 at 05:54:00PM -0200, Henrique de Moraes Holschuh wrote:
> void *intel_ucode_kmalloc(size_t size)
> {
> void *p = kmalloc(size, GFP_KERNEL);

Actually I was thinking of this:

void *p = kmalloc(size + 16, GFP_KERNEL);
if (!p)
return -ENOMEM;

if (unlikely((unsigned long)p & 0xf))
p_a = ALIGN(p, 16);

You'd need to stash the original *p somewhere for freeing later, of
course.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
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/