linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] x86/microcode: vsnprintf() might be unavailable
@ 2015-06-02 14:56 Andy Shevchenko
  2015-06-02 16:24 ` Borislav Petkov
  2015-06-02 16:46 ` [PATCH 1/1] x86/microcode: vsnprintf() might be unavailable Andy Shevchenko
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2015-06-02 14:56 UTC (permalink / raw)
  To: Borislav Petkov, Ingo Molnar, linux-kernel; +Cc: Andy Shevchenko

On Intel CPUs with x32 kernels we call load_builtin_intel_microcode() from
head_32.S on quite earlier stage. At that point sprintf() might be out of scope
to be called. As a result the 32-bit kernel does not boot on Intel CPUs. It has
been tested on Braswell and Merrifield.

The patch changes sprintf() call to plain code which does the same in this
particular case.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/kernel/cpu/microcode/intel_early.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c
index 10dff3f..a250f41 100644
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -523,9 +523,9 @@ EXPORT_SYMBOL_GPL(save_mc_for_early);
 
 static bool __init load_builtin_intel_microcode(struct cpio_data *cp)
 {
-	u32 eax = 0x00000001, ebx, ecx = 0, edx;
-	int family, model, stepping;
-	char name[30];
+	unsigned int eax = 0x00000001, ebx, ecx = 0, edx;
+	unsigned int family, model, stepping;
+	char name[30] = "intel-ucode", *p = name + 11;
 
 	native_cpuid(&eax, &ebx, &ecx, &edx);
 
@@ -533,7 +533,12 @@ static bool __init load_builtin_intel_microcode(struct cpio_data *cp)
 	model    = x86_model(eax);
 	stepping = eax & 0xf;
 
-	sprintf(name, "intel-ucode/%02x-%02x-%02x", family, model, stepping);
+	*p++ = '/';
+	p = hex_byte_pack(p, family);
+	*p++ = '-';
+	p = hex_byte_pack(p, model);
+	*p++ = '-';
+	p = hex_byte_pack(p, stepping);
 
 	return get_builtin_firmware(cp, name);
 }
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-04  9:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 14:56 [PATCH 1/1] x86/microcode: vsnprintf() might be unavailable Andy Shevchenko
2015-06-02 16:24 ` Borislav Petkov
2015-06-02 16:49   ` Andy Shevchenko
2015-06-02 17:00     ` Borislav Petkov
2015-06-02 17:31       ` Andy Shevchenko
2015-06-03 10:56         ` Borislav Petkov
2015-06-03 15:27           ` Andy Shevchenko
2015-06-03 17:49             ` Shevchenko, Andriy
2015-06-03 21:13               ` Borislav Petkov
2015-06-04  9:21                 ` [PATCH] x86/microcode: Disable builtin microcode loading on 32-bit for now Borislav Petkov
2015-06-04  9:47                   ` Shevchenko, Andriy
2015-06-02 16:46 ` [PATCH 1/1] x86/microcode: vsnprintf() might be unavailable Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).