Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2018 21:08:58 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338156 - head/sys/dev/cxgbe/common
Message-ID:  <201808212108.w7LL8wbj069523@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808212108.w7LL8wbj069523>