[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211209033127.2051504-1-jiasheng@iscas.ac.cn>
Date: Thu, 9 Dec 2021 11:31:27 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com
Cc: linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] sched/uclamp: potential dereference of null pointer
The return value of kzalloc() needs to be checked.
To avoid use of null pointer in case of the failure of alloc.
Fixes: 391e43da797a ("sched: Move all scheduler bits into kernel/sched/")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e5858999b54d..988a4a372e14 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8125,6 +8125,8 @@ void __init sched_init(void)
#endif
if (ptr) {
ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
+ if (!ptr)
+ return;
#ifdef CONFIG_FAIR_GROUP_SCHED
root_task_group.se = (struct sched_entity **)ptr;
--
2.25.1
Powered by blists - more mailing lists