diff options
| -rw-r--r-- | fs/pstore/ram_core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index f1848cdd6d34..f8b9b47e8b24 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -447,6 +447,13 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size, kfree(pages); /* + * vmap() may fail and return NULL. Do not add the offset in this + * case, otherwise a NULL mapping would appear successful. + */ + if (!vaddr) + return NULL; + + /* * Since vmap() uses page granularity, we must add the offset * into the page here, to get the byte granularity address * into the mapping to represent the actual "start" location. |
