lkml.org 
[lkml]   [2010]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] drbd: Check-kmalloc-return-value before use it
From
Check-kmalloc-return-value before use it

Signed-off-by: Liu Qi <lingjiujianke@gmail.com>
---
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


\
 
 \ /
  Last update: 2010-05-18 07:33    [from the cache]
©2003-2011 Jasper Spaans