Skip to content

Commit

Permalink
blkcg: add missing NULL check in ioc_cpd_alloc()
Browse files Browse the repository at this point in the history
ioc_cpd_alloc() forgot to check NULL return from kzalloc().  Add it.

Signed-off-by: Tejun Heo <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
htejun authored and axboe committed Aug 30, 2019
1 parent 3532e72 commit e916ad2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-iocost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,10 @@ static struct blkcg_policy_data *ioc_cpd_alloc(gfp_t gfp)
struct ioc_cgrp *iocc;

iocc = kzalloc(sizeof(struct ioc_cgrp), gfp);
iocc->dfl_weight = CGROUP_WEIGHT_DFL;
if (!iocc)
return NULL;

iocc->dfl_weight = CGROUP_WEIGHT_DFL;
return &iocc->cpd;
}

Expand Down

0 comments on commit e916ad2

Please sign in to comment.