summaryrefslogtreecommitdiff
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 27c059e1760a..11f918d34b1e 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -133,7 +133,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
struct persistent_ram_zone *prz;
int i = (*c)++;
- if (i >= max)
+ /* Give up if we never existed or have hit the end. */
+ if (!przs || i >= max)
return NULL;
prz = przs[i];