On Fri, 9 Aug 2024 at 12:55, Richard Weinberger <rich...@nod.at> wrote: > > 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 <rich...@nod.at> > --- > fs/ext4/ext4_common.h | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > 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 <ext4fs.h> > #include <malloc.h> > #include <asm/cache.h> > +#include <linux/compat.h> > #include <linux/errno.h> > #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, > -- > 2.35.3 >
Reviewed-by: Ilias Apalodimas <ilias.apalodi...@linaro.org>