Skip to content

Commit

Permalink
nfs: add kmalloc return value check in decode_and_add_ds
Browse files Browse the repository at this point in the history
add kmalloc return value check in decode_and_add_ds

Signed-off-by: Stanislav Fomichev <kernel@fomichev.me>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Stanislav Fomichev authored and Trond Myklebust committed Mar 10, 2011
1 parent a5e5026 commit b9f8105
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/nfs/nfs4filelayoutdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ decode_and_add_ds(__be32 **pp, struct inode *inode)
goto out_err;
}
buf = kmalloc(rlen + 1, GFP_KERNEL);
if (!buf) {
dprintk("%s: Not enough memory\n", __func__);
goto out_err;
}
buf[rlen] = '\0';
memcpy(buf, r_addr, rlen);

Expand Down

0 comments on commit b9f8105

Please sign in to comment.