cpufreq: cpufreq_interactive: avoid NULL point access
authorChen Liang <cl@rock-chips.com>
Thu, 24 Nov 2016 08:17:51 +0000 (16:17 +0800)
committerChen Liang <cl@rock-chips.com>
Thu, 24 Nov 2016 08:35:50 +0000 (16:35 +0800)
Change-Id: Id21a45eff24575ade7786a88d076ddd50cba6520
Signed-off-by: Chen Liang <cl@rock-chips.com>
drivers/cpufreq/cpufreq_interactive.c

index d9927f9..055e990 100644 (file)
@@ -1171,6 +1171,9 @@ static void cpufreq_interactive_input_event(struct input_handle *handle,
        now = ktime_to_us(ktime_get());
        for_each_online_cpu(i) {
                pcpu = &per_cpu(cpuinfo, i);
        now = ktime_to_us(ktime_get());
        for_each_online_cpu(i) {
                pcpu = &per_cpu(cpuinfo, i);
+               if (!pcpu->policy)
+                       continue;
+
                if (have_governor_per_policy())
                        tunables = pcpu->policy->governor_data;
                else
                if (have_governor_per_policy())
                        tunables = pcpu->policy->governor_data;
                else