Commit 0aa61e78 authored by Trond Myklebust's avatar Trond Myklebust

pNFS: Handle allocation errors correctly in objlayout_alloc_layout_hdr()

Return the NULL pointer when the allocation fails.

Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 6df200f5
...@@ -53,10 +53,10 @@ objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags) ...@@ -53,10 +53,10 @@ objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
struct objlayout *objlay; struct objlayout *objlay;
objlay = kzalloc(sizeof(struct objlayout), gfp_flags); objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
if (objlay) { if (!objlay)
spin_lock_init(&objlay->lock); return NULL;
INIT_LIST_HEAD(&objlay->err_list); spin_lock_init(&objlay->lock);
} INIT_LIST_HEAD(&objlay->err_list);
dprintk("%s: Return %p\n", __func__, objlay); dprintk("%s: Return %p\n", __func__, objlay);
return &objlay->pnfs_layout; return &objlay->pnfs_layout;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment