[coreboot-gerrit] Patch set updated for coreboot: 33191fd Intel: Return and warn when NULL is passed to `intel_update_microcode`
Paul Menzel (paulepanter@users.sourceforge.net)
gerrit at coreboot.org
Sat Mar 30 21:37:32 CET 2013
Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2990
-gerrit
commit 33191fd5e9fee00f23eea172402a57070430d5c5
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date: Tue Mar 12 15:53:44 2013 +0100
Intel: Return and warn when NULL is passed to `intel_update_microcode`
Not selecting `CPU_MICROCODE_IN_CBFS` in Kconfig and calling the
function `intel_update_microcode` with NULL results in a crash due
to the null pointer being dereferenced later on.
for(c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
Fix this by just returning if `microcode_updates` is `NULL` and by
printing a warning.
This patch is successfully tested on the Lenovo X201.
Change-Id: I6e18fd37256910bf047061e4633a66cf29ad7b69
Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
src/cpu/intel/microcode/microcode.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c
index d908c25..440afa9 100644
--- a/src/cpu/intel/microcode/microcode.c
+++ b/src/cpu/intel/microcode/microcode.c
@@ -131,7 +131,10 @@ const void *intel_microcode_find(void)
#endif
if (!microcode_updates)
- return microcode_updates;
+ /* No need for an explicit error message since the user
+ * already gets "file not found" from CBFS.
+ */
+ return microcode_updates; /* NULL */
/* CPUID sets MSR 0x8B iff a microcode update has been loaded. */
msr.lo = 0;
@@ -202,6 +205,12 @@ void intel_update_microcode(const void *microcode_updates)
const char *c;
msr_t msr;
+ if (!microcode_updates) {
+ printk(BIOS_WARNING, "%s: No microcode update was passed! (microcode_updates = NULL)\n",
+ __func__);
+ return;
+ }
+
/* CPUID sets MSR 0x8B iff a microcode update has been loaded. */
msr.lo = 0;
msr.hi = 0;
More information about the coreboot-gerrit
mailing list