]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bcache: check for allocation failures
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 5 Jul 2013 06:05:46 +0000 (09:05 +0300)
committerKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 07:22:46 +0000 (00:22 -0700)
There is a missing NULL check after the kzalloc().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
drivers/md/bcache/sysfs.c

index dd3f00a42729533853608ebe8db8b7dd3962b8f8..12a2c2846f994a1e2d51bf79374426df96893418 100644 (file)
@@ -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=bcache");
                add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
                add_uevent_var(env, "CACHED_LABEL=%s", buf);