mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] JFFS2: NULL return of kmem_cache_zalloc should be handled.
@ 2013-12-02 10:37 Zhouyi Zhou
  2013-12-09 19:51 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Zhouyi Zhou @ 2013-12-02 10:37 UTC (permalink / raw)
  To: dwmw2, linux-mtd, linux-kernel; +Cc: Zhouyi Zhou

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@ict.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] JFFS2: NULL return of kmem_cache_zalloc should be handled.
  2013-12-02 10:37 [PATCH] JFFS2: NULL return of kmem_cache_zalloc should be handled Zhouyi Zhou
@ 2013-12-09 19:51 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2013-12-09 19:51 UTC (permalink / raw)
  To: Zhouyi Zhou; +Cc: dwmw2, linux-mtd, linux-kernel, Zhouyi Zhou

On Mon, Dec 02, 2013 at 06:37:05PM +0800, Zhouyi Zhou wrote:
> 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@ict.ac.cn>

Pushed to l2-mtd.git. Thanks!

Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-09 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 10:37 [PATCH] JFFS2: NULL return of kmem_cache_zalloc should be handled Zhouyi Zhou
2013-12-09 19:51 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®