summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2024-08-09 11:54:30 +0200
committerTom Rini <trini@konsulko.com>2024-08-15 16:14:36 -0600
commit107ed84602bb5b77c333e3a4f373db5e62b50c61 (patch)
treebd95030b932c1bdf64fcf3bf951b8f996451ff99 /fs
parenta29805d822c4bffe47b464e1f62fca11c6c2b481 (diff)
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 <richard@nod.at> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_common.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h
index 84500e990aa..346752092b0 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,