linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH block/for-next] blkcg: add missing NULL check in ioc_cpd_alloc()
@ 2019-08-30 13:10 Tejun Heo
  2019-08-30 13:16 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2019-08-30 13:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel

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>
---
 block/blk-iocost.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH block/for-next] blkcg: add missing NULL check in ioc_cpd_alloc()
  2019-08-30 13:10 [PATCH block/for-next] blkcg: add missing NULL check in ioc_cpd_alloc() Tejun Heo
@ 2019-08-30 13:16 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-08-30 13:16 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-block, linux-kernel

On 8/30/19 7:10 AM, Tejun Heo wrote:
> ioc_cpd_alloc() forgot to check NULL return from kzalloc().  Add it.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-30 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 13:10 [PATCH block/for-next] blkcg: add missing NULL check in ioc_cpd_alloc() Tejun Heo
2019-08-30 13:16 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).