From 4853f03dee2ed17cc421260d669377db253f0dac Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 1 Apr 2020 22:45:22 +0100 Subject: [PATCH] x86/ucode: Don't try to cope with NULL pointers in apply_microcode() No paths to apply_microcode() pass a NULL pointer, and other hooks don't tolerate one in the first place. We can expect the core logic not to pass us junk, so drop the checks. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/x86/cpu/microcode/amd.c | 3 --- xen/arch/x86/cpu/microcode/intel.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index c9656de55d..0ca0e9a038 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -219,9 +219,6 @@ static int apply_microcode(const struct microcode_patch *patch) struct cpu_signature *sig = &per_cpu(cpu_sig, cpu); uint32_t rev, old_rev = sig->rev; - if ( !patch ) - return -ENOENT; - if ( microcode_fits(patch) != NEW_UCODE ) return -EINVAL; diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index 315fca9ff2..9cb077b583 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -270,9 +270,6 @@ static int apply_microcode(const struct microcode_patch *patch) struct cpu_signature *sig = &this_cpu(cpu_sig); uint32_t rev, old_rev = sig->rev; - if ( !patch ) - return -ENOENT; - if ( microcode_update_match(patch) != NEW_UCODE ) return -EINVAL; -- 2.30.2