Skip to contentSkip to conversation

nfs: add kmalloc return value check in decode_and_add_ds

PATCH New Stanislav Fomichev 1 participant 1 message Feb 5, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs: add kmalloc return value check in decode_and_add_ds

add kmalloc return value check in decode_and_add_ds

---
 fs/nfs/nfs4filelayoutdev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/nfs/nfs4filelayoutdev.c +4 -0
index f5c9b12..b73c343 100644
@@ -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);
 
Signature · 1 line
1.7.1