Skip to contentSkip to conversation

ARM: tegra30: clk: Fix output_rate overflow

PATCH Applied Mark Zhang 2 participants 2 messages Oct 16, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Mark Zhang

author
#0 lore raw

PATCH 1/1 ARM: tegra30: clk: Fix output_rate overflow

Change the type of variable from "unsigned long" to "u64". This avoids the overflow while clock rate calculating.

---
 arch/arm/mach-tegra/tegra30_clocks.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-tegra/tegra30_clocks.c +1 -1
index 5cd502c..e9de5df 100644
@@ -1199,7 +1199,7 @@ static long tegra30_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 {
 	struct clk_tegra *c = to_clk_tegra(hw);
 	unsigned long input_rate = *prate;
-	unsigned long output_rate = *prate;
+	u64 output_rate = *prate;
 	const struct clk_pll_freq_table *sel;
 	struct clk_pll_freq_table cfg;
 	int mul;
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to a message not in the archive
Quoted 2 lines · Mark Zhang

Change the type of variable from "unsigned long" to "u64". This avoids the overflow while clock rate calculating.

Thanks, applied to Tegra's for-3.7/fixes-for-rc2 branch.

Prashant, this same bug was found before in another round_rate() or similar function, and I'd asked you to audit the entire Tegra clock driver for any similar issues. Could you (and/or Mark) please take another look at the entire driver to make sure we don't keep finding this issue clock-by-clock. Thanks.