If the size is too small, return an error, since no_blk_pergdt is assumed to be non-zero in the following code.
Signed-off-by: Simon Glass <s...@chromium.org> --- (no changes since v1) fs/ext4/ext4_write.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index ae26354fbb2..f9d5eccb2ca 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -116,6 +116,8 @@ int ext4fs_get_bgdtable(void) return -1; gdsize_total = ROUND(alloc_size, fs->blksz); fs->no_blk_pergdt = gdsize_total / fs->blksz; + if (!fs->no_blk_pergdt) + return -1; /* allocate memory for gdtable */ fs->gdtable = zalloc(gdsize_total); -- 2.43.0