diff options
author | Vladimir Serbinenko <phcoder@gmail.com> | 2013-03-30 12:04:23 +0100 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-04-23 03:30:22 +0200 |
commit | 2c88cc0696be2b01ebd4df6f7593d8658c8fe419 (patch) | |
tree | 0599c602c43cc928b65e2e96835e4e29567f6df9 /src/cpu/samsung/exynos5-common/spi.c | |
parent | aee444f453f38e53f3e2ac54b560707616767869 (diff) |
Intel microcode: Return when `microcode_updates` is `NULL`
Add a safety check in function `intel_update_microcode` to return when
accidentally `NULL` is passed as `microcode_updates`, which would lead
to a null pointer dereference later on.
for (c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
While at it, use `return NULL` for clarity in function
`intel_microcode_find` and include the header file `stddef.h`. for it.
The review of this patch had some more discussion on adding more
comments and more detailed error messages. But this should be done in
a separate patch.
For clarity here some history, on how this was found and what caused
the discussion and confusion.
Originally when Vladimir made this improvement, selecting
`CPU_MICROCODE_IN_CBFS` in Kconfig but not having the microcode blob
`cpu_microcode_blob.bin` in CBFS resulted in a null pointer dereference
later on causing a crash.
for (c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
Vladimir fixed this by returning if `microcode_updates` is `NULL`,
that means no file is found and successfully tested this on his
Lenovo X201.
When pushing the patch to Gerrit for review, the code was rewritten
though by Aaron in commit »intel microcode: split up microcode loading
stages« (98ffb426) [1], which also returns when no file is found. So
the other parts of the code were checked and the safety check as
described above is added.
[1] http://review.coreboot.org/2778
Change-Id: I6e18fd37256910bf047061e4633a66cf29ad7b69
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/2990
Reviewed-by: Aaron Durbin <adurbin@google.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/cpu/samsung/exynos5-common/spi.c')
0 files changed, 0 insertions, 0 deletions