From 5f0d8ee6ba65eae0b4e446b94df0da0b58e1111f Mon Sep 17 00:00:00 2001 From: Lingutla Chandrasekhar Date: Tue, 23 Jun 2020 17:52:27 +0530 Subject: [PATCH] sched: core_ctl: Fix possible uninitialized variable While setting boost to cluster_data, we iterate clusters with local uninitialized cluster variable, it is possible that, the cluster could be null and is used in trace point. Fix it by moving trace print to cluster validated point. Change-Id: I466a92f2640cd5058f79355ee0cf354c41c79f7b Signed-off-by: Lingutla Chandrasekhar --- kernel/sched/core_ctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core_ctl.c b/kernel/sched/core_ctl.c index f31d727d74f4..dc695b0db063 100644 --- a/kernel/sched/core_ctl.c +++ b/kernel/sched/core_ctl.c @@ -866,7 +866,7 @@ static u64 core_ctl_check_timestamp; int core_ctl_set_boost(bool boost) { unsigned int index = 0; - struct cluster_data *cluster; + struct cluster_data *cluster = NULL; unsigned long flags; int ret = 0; bool boost_state_changed = false; @@ -897,7 +897,8 @@ int core_ctl_set_boost(bool boost) apply_need(cluster); } - trace_core_ctl_set_boost(cluster->boost, ret); + if (cluster) + trace_core_ctl_set_boost(cluster->boost, ret); return ret; }