Prev: random: Check kmalloc return value and give the failed message
Next: [PATCH] cciss: fix code style in drivers/block/cciss_scsi.c
From: Steven Liu on 18 May 2010 01:40 Check-kmalloc-return-value before use it Signed-off-by: Liu Qi <lingjiujianke(a)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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |