From: Chao Gao Date: Fri, 30 Aug 2019 08:22:55 +0000 (+0200) Subject: x86/ucode/AMD: make freeing of old ucode conditional X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1689 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=932f26d9d8825261c5a8c78b113efb6cb2ed2036;p=xen.git x86/ucode/AMD: make freeing of old ucode conditional It is certain to be NULL at least the first time through. Reported-by: Sander Eikelenboom Signed-off-by: Chao Gao Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/microcode_amd.c index 306978457b..9b743307c4 100644 --- a/xen/arch/x86/microcode_amd.c +++ b/xen/arch/x86/microcode_amd.c @@ -552,9 +552,12 @@ static int cpu_request_microcode(unsigned int cpu, const void *buf, mc_old = mc_amd; } - xfree(mc_old->mpb); - xfree(mc_old->equiv_cpu_table); - xfree(mc_old); + if ( mc_old ) + { + xfree(mc_old->mpb); + xfree(mc_old->equiv_cpu_table); + xfree(mc_old); + } out: #if CONFIG_HVM