mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 23:41:50 +00:00
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>
This commit is contained in:
parent
a29805d822
commit
107ed84602
1 changed files with 2 additions and 3 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include <ext4fs.h>
|
#include <ext4fs.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
|
#include <linux/compat.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#if defined(CONFIG_EXT4_WRITE)
|
#if defined(CONFIG_EXT4_WRITE)
|
||||||
#include "ext4_journal.h"
|
#include "ext4_journal.h"
|
||||||
|
@ -43,9 +44,7 @@
|
||||||
|
|
||||||
static inline void *zalloc(size_t size)
|
static inline void *zalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *p = memalign(ARCH_DMA_MINALIGN, size);
|
return kzalloc(size, 0);
|
||||||
memset(p, 0, size);
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ext4fs_read_inode(struct ext2_data *data, int ino,
|
int ext4fs_read_inode(struct ext2_data *data, int ino,
|
||||||
|
|
Loading…
Add table
Reference in a new issue