]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86/ucode/AMD: make freeing of old ucode conditional
authorChao Gao <chao.gao@intel.com>
Fri, 30 Aug 2019 08:22:55 +0000 (10:22 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 30 Aug 2019 08:22:55 +0000 (10:22 +0200)
It is certain to be NULL at least the first time through.

Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/microcode_amd.c

index 306978457b855ab40a3adda7fce2187e5de81196..9b743307c46286434dc6d6bef027122654e6ad7b 100644 (file)
@@ -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