[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1385980625-26545-1-git-send-email-yizhouzhou@ict.ac.cn>
Date: Mon, 2 Dec 2013 18:37:05 +0800
From: Zhouyi Zhou <zhouzhouyi@...il.com>
To: <dwmw2@...radead.org>, <linux-mtd@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Cc: Zhouyi Zhou <yizhouzhou@....ac.cn>
Subject: [PATCH] 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: Zhouyi Zhou <yizhouzhou@....ac.cn>
---
fs/jffs2/malloc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index 4f47aa2..b8fd651 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -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;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists