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

Borislav Petkov
2014-11-12T12:31:24Z

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