Skip to content

Commit

Permalink
pNFS: Handle allocation errors correctly in filelayout_alloc_layout_h…
Browse files Browse the repository at this point in the history
…dr()

Return the NULL pointer when the allocation fails.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: <stable@vger.kernel.org> # 3.5.x
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Trond Myklebust committed May 30, 2014
1 parent c8e4702 commit 6df200f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/nfs4filelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
struct nfs4_filelayout *flo;

flo = kzalloc(sizeof(*flo), gfp_flags);
return &flo->generic_hdr;
return flo != NULL ? &flo->generic_hdr : NULL;
}

static void
Expand Down

0 comments on commit 6df200f

Please sign in to comment.