diff options
| author | Zhouyi Zhou <zhouzhouyi@gmail.com> | 2013-12-02 05:37:05 -0500 |
|---|---|---|
| committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-03 14:22:22 -0500 |
| commit | 2072552c33c82e7f0c7adfac7965ecf40b739f1a (patch) | |
| tree | 0a41b8eea90ce58e35bc92b94e7af6c544641d8f /fs/jffs2 | |
| parent | 20171642ed064815fd4372e9e8b1fedff79148f1 (diff) | |
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@ict.ac.cn>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'fs/jffs2')
| -rw-r--r-- | fs/jffs2/malloc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c index 4f47aa24b556..b8fd651307a4 100644 --- a/fs/jffs2/malloc.c +++ b/fs/jffs2/malloc.c | |||
| @@ -288,6 +288,8 @@ struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void) | |||
| 288 | struct jffs2_xattr_datum *xd; | 288 | struct jffs2_xattr_datum *xd; |
| 289 | xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL); | 289 | xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL); |
| 290 | dbg_memalloc("%p\n", xd); | 290 | dbg_memalloc("%p\n", xd); |
| 291 | if (!xd) | ||
| 292 | return NULL; | ||
| 291 | 293 | ||
| 292 | xd->class = RAWNODE_CLASS_XATTR_DATUM; | 294 | xd->class = RAWNODE_CLASS_XATTR_DATUM; |
| 293 | xd->node = (void *)xd; | 295 | xd->node = (void *)xd; |
| @@ -306,6 +308,8 @@ struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void) | |||
| 306 | struct jffs2_xattr_ref *ref; | 308 | struct jffs2_xattr_ref *ref; |
| 307 | ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL); | 309 | ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL); |
| 308 | dbg_memalloc("%p\n", ref); | 310 | dbg_memalloc("%p\n", ref); |
| 311 | if (!ref) | ||
| 312 | return NULL; | ||
| 309 | 313 | ||
| 310 | ref->class = RAWNODE_CLASS_XATTR_REF; | 314 | ref->class = RAWNODE_CLASS_XATTR_REF; |
| 311 | ref->node = (void *)ref; | 315 | ref->node = (void *)ref; |
