lkml.org 
[lkml]   [2014]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 7/8] x86, microcode, intel: guard against misaligned microcode data
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.
--


\
 
 \ /
  Last update: 2014-11-12 14:21    [W:0.117 / U:1.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site