mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* fishy code in arch/x86/kernel/tsc.c:time_cpufreq_notifier()
@ 2009-06-01 14:21 Christoph Hellwig
  2009-06-01 16:29 ` Dave Jones
  2009-06-01 22:54 ` Daniel Barkalow
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2009-06-01 14:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

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))
#ifdef CONFIG_SMP
		lpj = &cpu_data(freq->cpu).loops_per_jiffy;
#else
	lpj = &boot_cpu_data.loops_per_jiffy;
#endif

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-06-01 22:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-01 14:21 fishy code in arch/x86/kernel/tsc.c:time_cpufreq_notifier() Christoph Hellwig
2009-06-01 16:29 ` Dave Jones
2009-06-01 16:39   ` Christoph Hellwig
2009-06-01 20:56     ` Jon Masters
2009-06-01 21:49       ` Michael S. Zick
2009-06-01 21:50         ` Michael S. Zick
2009-06-01 22:54 ` Daniel Barkalow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®