Author: np
Date: Tue Aug 21 21:08:58 2018
New Revision: 338156
URL: https://svnweb.freebsd.org/changeset/base/338156

Log:
  cxgbe(4): Avoid overflow while calculating channel rate.
  
  Reported by:  Coverity (CID 1008352)
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- head/sys/dev/cxgbe/common/t4_hw.c   Tue Aug 21 19:28:53 2018        
(r338155)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Tue Aug 21 21:08:58 2018        
(r338156)
@@ -5770,7 +5770,7 @@ int t4_set_sched_ipg(struct adapter *adap, int sched, 
  */
 static u64 chan_rate(struct adapter *adap, unsigned int bytes256)
 {
-       u64 v = bytes256 * adap->params.vpd.cclk;
+       u64 v = (u64)bytes256 * adap->params.vpd.cclk;
 
        return v * 62 + v / 2;
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to