lkml.org 
[lkml]   [2015]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] x86/microcode: vsnprintf() might be unavailable
Date
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


\
 
 \ /
  Last update: 2015-06-02 17:21    [W:0.084 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site