summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libcbfs/ram_media.c
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/libcbfs/ram_media.c')
-rw-r--r--payloads/libpayload/libcbfs/ram_media.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/payloads/libpayload/libcbfs/ram_media.c b/payloads/libpayload/libcbfs/ram_media.c
index 87b5292b63..1a0500e1be 100644
--- a/payloads/libpayload/libcbfs/ram_media.c
+++ b/payloads/libpayload/libcbfs/ram_media.c
@@ -43,7 +43,11 @@ static int ram_open(struct cbfs_media *media) {
static void *ram_map(struct cbfs_media *media, size_t offset, size_t count) {
struct ram_media *m = (struct ram_media*)media->context;
- if (offset + count >= m->size) {
+ /* assume addressing from top of image in this case */
+ if (offset > 0xf0000000) {
+ offset = m->size + offset;
+ }
+ if (offset + count > m->size) {
printf("ERROR: ram_map: request out of range (0x%x+0x%x)\n",
offset, count);
return NULL;