summaryrefslogtreecommitdiff
path: root/fs/pstore/zone.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/zone.c')
-rw-r--r--fs/pstore/zone.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c
index 694db616663f..ceb5639a0629 100644
--- a/fs/pstore/zone.c
+++ b/fs/pstore/zone.c
@@ -1212,6 +1212,11 @@ static struct pstore_zone **psz_init_zones(enum pstore_type_id type,
}
c = total_size / record_size;
+ if (unlikely(!c)) {
+ pr_err("zone %s total_size too small\n", name);
+ return ERR_PTR(-EINVAL);
+ }
+
zones = kcalloc(c, sizeof(*zones), GFP_KERNEL);
if (!zones) {
pr_err("allocate for zones %s failed\n", name);