Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2072552c authored by Zhouyi Zhou's avatar Zhouyi Zhou Committed by Brian Norris
Browse files

jffs2: NULL return of kmem_cache_zalloc should be handled



NULL return of kmem_cache_zalloc should be handled in jffs2_alloc_xattr_datum
and jff2_alloc_xattr_ref.

Signed-off-by: default avatarZhouyi Zhou <yizhouzhou@ict.ac.cn>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 20171642
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -288,6 +288,8 @@ struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void)
	struct jffs2_xattr_datum *xd;
	xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL);
	dbg_memalloc("%p\n", xd);
	if (!xd)
		return NULL;

	xd->class = RAWNODE_CLASS_XATTR_DATUM;
	xd->node = (void *)xd;
@@ -306,6 +308,8 @@ struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void)
	struct jffs2_xattr_ref *ref;
	ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL);
	dbg_memalloc("%p\n", ref);
	if (!ref)
		return NULL;

	ref->class = RAWNODE_CLASS_XATTR_REF;
	ref->node = (void *)ref;