Skip to contentSkip to conversation

bcache: check for allocation failures

PATCH In review Dan Carpenter 2 participants 2 messages Jul 5, 2013 – Jul 11, 2013 1 message not in the archive

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

PATCH 1/1 bcache: check for allocation failures

There is a missing NULL check after the kzalloc().

drivers/md/bcache/sysfs.c +2 -0
index 48f0353..4fe6ab2 100644
@@ -232,6 +232,8 @@ STORE(__cached_dev)
 			bch_uuid_write(dc->disk.c);
 		}
 		env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
+		if (!env)
+			return -ENOMEM;
 		add_uevent_var(env, "DRIVER¼ache");
 		add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
 		add_uevent_var(env, "CACHED_LABEL=%s", buf);

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 9 lines · Dan Carpenter

There is a missing NULL check after the kzalloc().

drivers/md/bcache/sysfs.c +0 -0
index 48f0353..4fe6ab2 100644

drivers/md/bcache/sysfs.c STORE(__cached_dev) · line 239

Quoted 8 lines
drivers/md/bcache/sysfs.c +2 -0
@@ -232,6 +232,8 @@ STORE(__cached_dev)
 			bch_uuid_write(dc->disk.c);
 		}
 		env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
+		if (!env)
+			return -ENOMEM;
 		add_uevent_var(env, "DRIVER¼ache");
 		add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
 		add_uevent_var(env, "CACHED_LABEL=%s", buf);

Thanks - applied
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html