diff mbox series

[3/5] x86/ucode: Don't try to cope with NULL pointers in apply_microcode()

Message ID 20200402101902.28234-4-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series x86/ucode: Cleanup part 5/n | expand

Commit Message

Andrew Cooper April 2, 2020, 10:19 a.m. UTC
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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/microcode/amd.c   | 3 ---
 xen/arch/x86/cpu/microcode/intel.c | 3 ---
 2 files changed, 6 deletions(-)

Comments

Jan Beulich April 3, 2020, 1:42 p.m. UTC | #1
On 02.04.2020 12:19, Andrew Cooper wrote:
> 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 <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

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;