pstore/zone: Add a null pointer check to the psz_kmsg_read
[linux-2.6-microblaze.git] / fs / pstore / zone.c
index 2770746..abca117 100644 (file)
@@ -973,6 +973,8 @@ static ssize_t psz_kmsg_read(struct pstore_zone *zone,
                char *buf = kasprintf(GFP_KERNEL, "%s: Total %d times\n",
                                      kmsg_dump_reason_str(record->reason),
                                      record->count);
+               if (!buf)
+                       return -ENOMEM;
                hlen = strlen(buf);
                record->buf = krealloc(buf, hlen + size, GFP_KERNEL);
                if (!record->buf) {