nfs: add kmalloc return value check in decode_and_add_ds

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>
This commit is contained in:
Stanislav Fomichev 2011-02-05 23:13:01 +00:00 committed by Trond Myklebust
parent a5e5026810
commit b9f810570d
1 changed files with 4 additions and 0 deletions

View File

@ -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);