summaryrefslogtreecommitdiffstats
path: root/block/blk-iocost.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2019-08-30 06:10:58 -0700
committerJens Axboe <axboe@kernel.dk>2019-08-30 07:16:19 -0600
commite916ad29d96485e5aa3d3237bfeab1522c713d5e (patch)
tree24563cc1b1d29f838c97cf6c1b110625317263c1 /block/blk-iocost.c
parent3532e7227243beb0b782266dc05c40b6184ad051 (diff)
downloadlinux-e916ad29d96485e5aa3d3237bfeab1522c713d5e.tar.bz2
blkcg: add missing NULL check in ioc_cpd_alloc()
ioc_cpd_alloc() forgot to check NULL return from kzalloc(). Add it. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-iocost.c')
-rw-r--r--block/blk-iocost.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 9c8046ac5925..2aae8ec391ef 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -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;
}