bcache: check for allocation failures

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
This commit is contained in:
Dan Carpenter 2013-07-05 09:05:46 +03:00 committed by Kent Overstreet
parent 6aa8f1a6ca
commit d2a65ce2ac
1 changed files with 2 additions and 0 deletions

View 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);