From e916ad29d96485e5aa3d3237bfeab1522c713d5e Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 30 Aug 2019 06:10:58 -0700 Subject: 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 Reported-by: kbuild test robot Signed-off-by: Jens Axboe --- block/blk-iocost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'block') 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; } -- cgit v1.2.3-58-ga151