mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* ppc32: Fix overflow in cpuinfo freq. display
@ 2005-03-15  4:12 Benjamin Herrenschmidt
  0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2005-03-15  4:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel list

Hi !

The CPU frequency in /proc/cpuinfo would overflow because of a
signed/unsigned bug. This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-work/arch/ppc/kernel/setup.c
===================================================================
--- linux-work.orig/arch/ppc/kernel/setup.c	2005-03-15 13:55:31.000000000 +1100
+++ linux-work/arch/ppc/kernel/setup.c	2005-03-15 14:21:27.000000000 +1100
@@ -338,14 +338,15 @@
 of_show_percpuinfo(struct seq_file *m, int i)
 {
 	struct device_node *cpu_node;
-	int *fp, s;
+	u32 *fp;
+	int s;
 	
 	cpu_node = find_type_devices("cpu");
 	if (!cpu_node)
 		return 0;
 	for (s = 0; s < i && cpu_node->next; s++)
 		cpu_node = cpu_node->next;
-	fp = (int *) get_property(cpu_node, "clock-frequency", NULL);
+	fp = (u32 *)get_property(cpu_node, "clock-frequency", NULL);
 	if (fp)
 		seq_printf(m, "clock\t\t: %dMHz\n", *fp / 1000000);
 	return 0;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-15  4:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-15  4:12 ppc32: Fix overflow in cpuinfo freq. display Benjamin Herrenschmidt

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®