From patchwork Tue Oct  2 11:46:49 2012
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: dm thin: check kmalloc in dm_deferred_set_create()
Date: Tue, 02 Oct 2012 16:46:49 -0000
From: Dan Carpenter <dan.carpenter@oracle.com>
X-Patchwork-Id: 53956
Message-id: <20121002114649.GA1413@elgon.mountain>

We can simply return NULL here.  The callers already handle that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

---
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index da0d5d1..fa7d21e 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -394,6 +394,8 @@ static struct dm_deferred_set *dm_deferred_set_create(void)
 	struct dm_deferred_set *ds;
 
 	ds = kmalloc(sizeof(*ds), GFP_KERNEL);
+	if (!ds)
+		return NULL;
 
 	spin_lock_init(&ds->lock);
 	ds->current_entry = 0;
