Message ID | CAKohponQ0vr7QXFun3GmPsMCGj6VOd3P0of6Hd5p4ZBG-_PxdQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6bd95bc..6e76417 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -228,6 +228,10 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus); unsigned int clip_freq; + /* Request state should be less than max_level */ + if (WARN_ON(state > cpufreq_device->max_level)) + return -EINVAL; + /* Check if the old cooling action is same as new cooling action */ if (cpufreq_device->cpufreq_state == state)