diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/cbfs.c | 5 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/fmap.c | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index fc6e88721e..84638dab88 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -175,8 +175,11 @@ void *cbfs_simple_buffer_map(struct cbfs_simple_buffer *buffer, "allocated=%zd, size=%zd, last_allocate=%zd\n", offset, count, buffer->allocated, buffer->size, buffer->last_allocate); - if (buffer->allocated + count > buffer->size) + if (buffer->allocated + count > buffer->size) { + ERROR("simple_buffer: no room to map %zd bytes from %#zx\n", + count, offset); return CBFS_MEDIA_INVALID_MAP_ADDRESS; + } if (media->read(media, address, offset, count) != count) { ERROR("simple_buffer: fail to read %zd bytes from 0x%zx\n", count, offset); diff --git a/src/vendorcode/google/chromeos/fmap.c b/src/vendorcode/google/chromeos/fmap.c index a8425c0d10..7c1f626f82 100644 --- a/src/vendorcode/google/chromeos/fmap.c +++ b/src/vendorcode/google/chromeos/fmap.c @@ -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; } |