Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/microcode/intel: Get rid of revision_is_newer()

It is a one-liner for checking microcode header revisions. On top of
that, it can be used wrong as it was the case in _save_mc(). Get rid of
it.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Borislav Petkov and committed by
Ingo Molnar
a1a32d29 5198b443

+4 -10
-6
arch/x86/include/asm/microcode_intel.h
··· 60 60 extern int microcode_sanity_check(void *mc, int print_err); 61 61 extern int get_matching_sig(unsigned int csig, int cpf, int rev, void *mc); 62 62 63 - static inline int 64 - revision_is_newer(struct microcode_header_intel *mc_header, int rev) 65 - { 66 - return (mc_header->rev <= rev) ? 0 : 1; 67 - } 68 - 69 63 #ifdef CONFIG_MICROCODE_INTEL_EARLY 70 64 extern void __init load_ucode_intel_bsp(void); 71 65 extern void load_ucode_intel_ap(void);
+1 -1
arch/x86/kernel/cpu/microcode/intel_early.c
··· 262 262 263 263 found = 1; 264 264 265 - if (!revision_is_newer(mc_hdr, new_rev)) 265 + if (mc_hdr->rev <= mc_saved_hdr->rev) 266 266 continue; 267 267 268 268 /*
+3 -3
arch/x86/kernel/cpu/microcode/intel_lib.c
··· 154 154 /* 155 155 * Returns 1 if update has been found, 0 otherwise. 156 156 */ 157 - int get_matching_microcode(unsigned int csig, int cpf, int rev, void *mc) 157 + int get_matching_microcode(unsigned int csig, int cpf, int new_rev, void *mc) 158 158 { 159 159 struct microcode_header_intel *mc_hdr = mc; 160 160 161 - if (!revision_is_newer(mc_hdr, rev)) 161 + if (mc_hdr->rev <= new_rev) 162 162 return 0; 163 163 164 - return get_matching_sig(csig, cpf, rev, mc); 164 + return get_matching_sig(csig, cpf, new_rev, mc); 165 165 } 166 166 EXPORT_SYMBOL_GPL(get_matching_microcode);