Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1560867

[PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd()

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject [PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd()
Date 2017-01-17 18:50 +0100
Message-ID <t0G3o-1zz-43@gated-at.bofh.it> (permalink)
References <t0FTI-1vq-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Borislav Petkov <bp@suse.de>

Use the generic helper instead of semi-open-coding the procedure.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/microcode/amd.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index e5cb7e73cb3b..340d636512c9 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -346,17 +346,15 @@ void load_ucode_amd_ap(unsigned int cpuid_1_eax)
 
 	/* First AP hasn't cached it yet, go through the blob. */
 	if (!cont.data) {
-		struct cpio_data cp = { NULL, 0, "" };
+		struct cpio_data cp;
 
 		if (cont.size == -1)
 			return;
 
 reget:
 		if (!get_builtin_microcode(&cp, x86_family(cpuid_1_eax))) {
-#ifdef CONFIG_BLK_DEV_INITRD
-			cp = find_cpio_data(ucode_path, (void *)initrd_start,
-					    initrd_end - initrd_start, NULL);
-#endif
+			cp = find_microcode_in_initrd(ucode_path, false);
+
 			if (!(cp.data && cp.size)) {
 				/*
 				 * Mark it so that other APs do not scan again
@@ -410,13 +408,9 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
 
 	if (!cont.data) {
 		if (IS_ENABLED(CONFIG_X86_32) && (cont.size != -1)) {
-			struct cpio_data cp = { NULL, 0, "" };
-
-#ifdef CONFIG_BLK_DEV_INITRD
-			cp = find_cpio_data(ucode_path, (void *)initrd_start,
-					    initrd_end - initrd_start, NULL);
-#endif
+			struct cpio_data cp;
 
+			cp = find_microcode_in_initrd(ucode_path, false);
 			if (!(cp.data && cp.size)) {
 				cont.size = -1;
 				return -EINVAL;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] x86/microcode: 4.11 queue Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
  [PATCH 12/13] x86/microcode/AMD: Simplify saving from initrd Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 12/13] x86/microcode/AMD: Simplify saving from initrd Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
  [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:00 +0100
      Re: [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
  [PATCH 05/13] x86/microcode/AMD: Extend the container struct Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 05/13] x86/microcode/AMD: Extend the container struct Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:50 +0100
  [PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd() Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 09/13] x86/microcode/AMD: Use  find_microcode_in_initrd() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
  [PATCH 04/13] x86/microcode/AMD: Shorten function parameter's name Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 04/13] x86/microcode/AMD: Shorten function parameter's  name Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:10 +0100
  [PATCH 10/13] x86/microcode/AMD: Check patch level only on the BSP Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
    Re: [PATCH 10/13] x86/microcode/AMD: Check patch level only on the  BSP Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:50 +0100

csiph-web