Skip to content

Commit d2a65ce

Browse files
Dan CarpenterKent Overstreet
authored andcommitted
bcache: check for allocation failures
There is a missing NULL check after the kzalloc(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
1 parent 6aa8f1a commit d2a65ce

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/md/bcache/sysfs.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ STORE(__cached_dev)
232232
bch_uuid_write(dc->disk.c);
233233
}
234234
env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
235+
if (!env)
236+
return -ENOMEM;
235237
add_uevent_var(env, "DRIVER=bcache");
236238
add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
237239
add_uevent_var(env, "CACHED_LABEL=%s", buf);

0 commit comments

Comments
 (0)