[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230329133600.908723-1-yajun.deng@linux.dev>
Date: Wed, 29 Mar 2023 21:36:00 +0800
From: Yajun Deng <yajun.deng@...ux.dev>
To: rafael@...nel.org, viresh.kumar@...aro.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Yajun Deng <yajun.deng@...ux.dev>
Subject: [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target()
__resolve_freq() may be return target_freq if policy->freq_table is
NULL. In this case, it should return -EINVAL before __target_index().
Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
---
drivers/cpufreq/cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c0e5be0fe2d6..308a3df1a940 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2299,7 +2299,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
return cpufreq_driver->target(policy, target_freq, relation);
}
- if (!cpufreq_driver->target_index)
+ if (!cpufreq_driver->target_index || !policy->freq_table)
return -EINVAL;
return __target_index(policy, policy->cached_resolved_idx);
--
2.25.1
Powered by blists - more mailing lists