x86, microcode, AMD: Replace vmalloc+memset with vzalloc

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>
This commit is contained in:
Jesper Juhl 2010-11-01 22:44:34 +01:00 committed by Borislav Petkov
parent f6614b7bb4
commit 1ea6be212e
1 changed files with 10 additions and 9 deletions

View File

@ -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;
}