Bug 187223 - omap4 clock frequency computation overflow
Summary: omap4 clock frequency computation overflow
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-03 15:20 UTC by onwahe
Modified: 2014-07-26 04:35 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (560 bytes, patch)
2014-03-03 15:20 UTC, onwahe
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description onwahe 2014-03-03 15:20:00 UTC
uint32_t is not enough. See patch.

Fix: Patch attached with submission follows:
Comment 1 dfilter service freebsd_committer freebsd_triage 2014-03-06 22:32:18 UTC
Author: cognet
Date: Thu Mar  6 21:07:13 2014
New Revision: 262870
URL: http://svnweb.freebsd.org/changeset/base/262870

Log:
  When calculating the MPU freq, make sure not to overflow by using a uint64_t.
  
  PR:	arm/187223
  Submitted by:	Svatopluk Kraus <onwahe@gmail.com>

Modified:
  head/sys/arm/ti/omap4/omap4_prcm_clks.c

Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c
==============================================================================
--- head/sys/arm/ti/omap4/omap4_prcm_clks.c	Thu Mar  6 21:02:16 2014	(r262869)
+++ head/sys/arm/ti/omap4/omap4_prcm_clks.c	Thu Mar  6 21:07:13 2014	(r262870)
@@ -990,7 +990,7 @@ omap4_clk_get_arm_fclk_freq(struct ti_cl
 
 
 	/* Calculate the MPU freq */
-	mpuclk = (sysclk * pll_mult) / pll_div;
+	mpuclk = ((uint64_t)sysclk * pll_mult) / pll_div;
 
 	/* Return the value */
 	if (freq)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"