Skip to contentSkip to conversation

dm thin: check kmalloc in dm_deferred_set_create()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 2, 2012

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

PATCH 1/1 dm thin: check kmalloc in dm_deferred_set_create()

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

drivers/md/dm-thin.c +2 -0
index da0d5d1..fa7d21e 100644
@@ -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;
#1 lore raw
Quoted 1 line · Dan Carpenter

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

Folded into dm-thin-prepare-to-separate-bio_prison-code.patch in linux-next, thanks.

Alasdair