Skip to content

Commit 740ebe4

Browse files
atsushi-nemotoralfbaechle
authored andcommitted
MIPS: TXx9: Fix possible overflow in clock calculations
Addition of -fwrapv option in 2.6.29 discloses possible overflow with signed arithmetics. For example, result of "a * 6 / 12" (int a = 400000000) is 200000000 without -fwrapv but -157913941 with -fwrapv. Change some variable to unsigned to avoid such overflows. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 4f29c05 commit 740ebe4

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/mips/txx9/generic/setup_tx4927.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void __init tx4927_setup(void)
8888
{
8989
int i;
9090
__u32 divmode;
91-
int cpuclk = 0;
91+
unsigned int cpuclk = 0;
9292
u64 ccfg;
9393

9494
txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE,

‎arch/mips/txx9/generic/setup_tx4938.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void __init tx4938_setup(void)
9393
{
9494
int i;
9595
__u32 divmode;
96-
int cpuclk = 0;
96+
unsigned int cpuclk = 0;
9797
u64 ccfg;
9898

9999
txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE,

‎arch/mips/txx9/generic/setup_tx4939.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void __init tx4939_setup(void)
114114
int i;
115115
__u32 divmode;
116116
__u64 pcfg;
117-
int cpuclk = 0;
117+
unsigned int cpuclk = 0;
118118

119119
txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE,
120120
TX4939_REG_SIZE);

0 commit comments

Comments
 (0)