]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
cpufreq: ppc: Fix integer overflow in expression
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 17 Apr 2014 09:53:26 +0000 (11:53 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Apr 2014 21:47:06 +0000 (23:47 +0200)
On 32-bit, "12 * NSEC_PER_SEC" doesn't fit in "unsigned long"
(NSEC_PER_SEC is a "long" constant), causing an integer overflow:

drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init':
drivers/cpufreq/ppc-corenet-cpufreq.c:211:9: warning: integer overflow in expression [-Woverflow]

Force the intermediate to be 64-bit by adding an "ULL" suffix to the
constant multiplier to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/ppc-corenet-cpufreq.c

index b7e677be1df034cdebdea6580b5726bc77c9aa39..a1ca3dd04a8e7b616acf50467cbbf142f8325035 100644 (file)
@@ -206,7 +206,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
                per_cpu(cpu_data, i) = data;
 
        policy->cpuinfo.transition_latency =
-                               (12 * NSEC_PER_SEC) / fsl_get_sys_freq();
+                               (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq();
        of_node_put(np);
 
        return 0;