Skip to content

Commit

Permalink
x86, microcode, AMD: Replace vmalloc+memset with vzalloc
Browse files Browse the repository at this point in the history
We don't have to do memset() ourselves after vmalloc() when we have
vzalloc(), so change that in
arch/x86/kernel/microcode_amd.c::get_next_ucode().

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
  • Loading branch information
Jesper Juhl authored and Borislav Petkov committed Nov 10, 2010
1 parent f6614b7 commit 1ea6be2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,17 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
return NULL;
}

mc = vmalloc(UCODE_MAX_SIZE);
if (mc) {
memset(mc, 0, UCODE_MAX_SIZE);
if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
total_size)) {
vfree(mc);
mc = NULL;
} else
*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
mc = vzalloc(UCODE_MAX_SIZE);
if (!mc)
return NULL;

if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) {
vfree(mc);
mc = NULL;
} else {
*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
}

return mc;
}

Expand Down

0 comments on commit 1ea6be2

Please sign in to comment.