cbfs: Enforce media->map() result checking, improve error messages
If you try to boot a VBOOT2_VERIFY_FIRMWARE with less than 4K CBFS cache right now, your system will try and fail to validate the FMAP signature at (u8 *)0xFFFFFFFF and go into recovery mode. This patch avoids the memcmp() to potentially invalid memory, and also adds an error message to cbfs_simple_buffer_map() to make it explicit that we ran out of CBFS cache space. BUG=None TEST=Booted on Veyron_Pinky with reduced CBFS cache, saw the message. Change-Id: Ic5773b4e0b36dc621513f58fc9bd29c17afbf1b7 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222899 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
b104d5c1c3
commit
0ed3c0c2b6
2 changed files with 6 additions and 2 deletions
|
|
@ -51,7 +51,8 @@ const struct fmap *fmap_find(void)
|
|||
media->close(media);
|
||||
#endif
|
||||
|
||||
if (memcmp(fmap, FMAP_SIGNATURE, sizeof(FMAP_SIGNATURE)-1)) {
|
||||
if (fmap == CBFS_MEDIA_INVALID_MAP_ADDRESS ||
|
||||
memcmp(fmap, FMAP_SIGNATURE, sizeof(FMAP_SIGNATURE) - 1)) {
|
||||
printk(BIOS_DEBUG, "No FMAP found at %p.\n", fmap);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue