[lkml]   [2009]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectfishy code in arch/x86/kernel/tsc.c:time_cpufreq_notifier()
Just notice the following error from gcc 4.4:

arch/x86/kernel/tsc.c: In function 'time_cpufreq_notifier':
arch/x86/kernel/tsc.c:634: warning: 'dummy' may be used uninitialized in this function

dummy is only used in the following way in this function:

lpj = &dummy;

and then dummy might be overriden in the following odd way:

if (!(freq->flags & CPUFREQ_CONST_LOOPS))
lpj = &cpu_data(freq->cpu).loops_per_jiffy;
lpj = &boot_cpu_data.loops_per_jiffy;

and then is used in

if (!ref_freq) {
ref_freq = freq->old;
loops_per_jiffy_ref = *lpj;
tsc_khz_ref = tsc_khz;

to me that looks like it can indeed be used unitialized for the case
where we do have CONFIG_SMP set, freq->flags & CPUFREQ_CONST_LOOPS is
true and ref_freq is false.

Can that case actually happen?

 \ /
  Last update: 2009-06-01 16:23    [W:0.062 / U:2.928 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site