Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ea6be21 authored by Jesper Juhl's avatar Jesper Juhl Committed by Borislav Petkov
Browse files

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: default avatarJesper Juhl <jj@chaosbits.net>
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent f6614b7b
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -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)) {
	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
	} else {
		*mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
	}

	return mc;
}