[PATCH] drbd: Check-kmalloc-return-value before use it

From: Steven Liu
Date: Tue May 18 2010 - 01:30:23 EST


Check-kmalloc-return-value before use it

Signed-off-by: Liu Qi <lingjiujianke@xxxxxxxxx>
---
drivers/block/drbd/drbd_receiver.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c
b/drivers/block/drbd/drbd_receiver.c
index 3f096e7..533df04 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2977,6 +2977,10 @@ static int receive_uuids(struct drbd_conf
*mdev, struct p_header *h)
return FALSE;

p_uuid = kmalloc(sizeof(u64)*UI_EXTENDED_SIZE, GFP_NOIO);
+ if(p_uuid == NULL){
+ printk(KERN_ERR "Kmalloc p_uuid failed in %s \n", __func__);
+ return FALSE;
+ }

for (i = UI_CURRENT; i < UI_EXTENDED_SIZE; i++)
p_uuid[i] = be64_to_cpu(p->uuid[i]);
--
1.7.1


Best regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/