From: Richard Weinberger Date: Fri, 9 Aug 2024 09:54:30 +0000 (+0200) Subject: ext4: Fix zalloc() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=107ed84602bb5b77c333e3a4f373db5e62b50c61;p=u-boot.git ext4: Fix zalloc() Currently, zalloc() calls uncondtionally memset(), if the allocation failes, memset() will write to a null pointer. Fix by using kzalloc(). Signed-off-by: Richard Weinberger Reviewed-by: Heinrich Schuchardt --- diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h index 84500e990a..346752092b 100644 --- a/fs/ext4/ext4_common.h +++ b/fs/ext4/ext4_common.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #if defined(CONFIG_EXT4_WRITE) #include "ext4_journal.h" @@ -43,9 +44,7 @@ static inline void *zalloc(size_t size) { - void *p = memalign(ARCH_DMA_MINALIGN, size); - memset(p, 0, size); - return p; + return kzalloc(size, 0); } int ext4fs_read_inode(struct ext2_data *data, int ino,