diff options
author | David S. Miller <davem@davemloft.net> | 2016-03-29 21:51:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-29 21:51:34 -0400 |
commit | 442c756bb09387e097c9bda87eae9d5104c593af (patch) | |
tree | 87188dc821aed88bffff07f1f75f76daf1de9924 | |
parent | 54385dc044a255b87e694c4c0c9ed378823a33b4 (diff) | |
download | silo-442c756bb09387e097c9bda87eae9d5104c593af.tar.gz |
silo: Fix signed overflow issues with 'clock-frequency'.
Process it as an unsigned quantity so that all 32-bit values
work properly.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | second/timer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/second/timer.c b/second/timer.c index 7f03996..da3f92e 100644 --- a/second/timer.c +++ b/second/timer.c @@ -43,7 +43,7 @@ static int len_to_free; static unsigned long long sun4u_tickcmpr; static int sun4u_notimer = 0; static struct mostek48t02 *mregs; -static long clock_frequency; +static unsigned long clock_frequency; #define TICKER_VIRTUAL 0xfc000000 #define SUN4C_TIMER_PHYSADDR 0xf3000000 @@ -145,7 +145,8 @@ static inline int sun4u_init_timer () prom_getstring(node, "device_type", node_str, sizeof(node_str)); if (!strcmp(node_str, "cpu")) { foundcpu = 1; - clock_frequency = prom_getintdefault(node, "clock-frequency", 0) / 100; + clock_frequency = prom_getintdefault(node, "clock-frequency", 0); + clock_frequency /= 100; } } if (notimer) { @@ -154,8 +155,10 @@ static inline int sun4u_init_timer () notimer = 0; } } - if (!foundcpu || !clock_frequency) - clock_frequency = prom_getint(prom_root_node, "clock-frequency") / 100; + if (!foundcpu || !clock_frequency) { + clock_frequency = prom_getint(prom_root_node, "clock-frequency"); + clock_frequency /= 100; + } if (notimer && !sun4v_cpu) { sun4u_notimer = 1; __asm__ __volatile__ ("\t" |