From nobody Fri Nov 11 01:48:22 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N7hS70YZ4z4f42W; Fri, 11 Nov 2022 01:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N7hS66l7Dz3KgB; Fri, 11 Nov 2022 01:48:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668131303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dyOjHctYRnkfTKEmOSWQV6spfRqlUKQ6hGOhrgdHQ4k=; b=fhP8Z9/px4yBwn9mYnyTuSSwr4XED6j1zHtVtYbHCJYVuyYxwUmv9IgjkUGoHLDdR+teXK irKKPCAKVDa+0wrZoYwYN8Eb0uoDFaG3FxITm5AfH35tUe+7avq+PXI4Tq1mNZfOFeIEQa y+bGu5MV5yxDNXhcv+eRqlCCZj+7ZkEzg54IlxAd0MjAb8ilr/0mYoIXA+SNCdoUzULpXy 845GG9trXcGES3x+XUQ2dV2/QAsLBJbY7V8BSujooGQ00MEc/b0923AUn0RZq5Ft2RU0PM Oj3X+aXyGUKvZF92zbMJHsdPtNqx4IWyTFWmQD0DvYz4GK7Rnq06ILirjC3rLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668131303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dyOjHctYRnkfTKEmOSWQV6spfRqlUKQ6hGOhrgdHQ4k=; b=BFB/jPDmFTzD5Lko+T5sq9fNwk7yncBkFuxaUNwWOhYhOg2rWPn6AmjrrBBdUptDqxyFNp 80mCid8AOChxKtiiv/XPbL1/3Jnj4UBuzCTK8O+uBYQaHM6iRBAn48MMsG8RCMQn+D/EOm MGPLO7balV8mFkdJ2nqwYtEnU2AzGlP/fUJy8WGqSbr/xEJoDxFthsYGx6PezphLQZo4IV xAhlzaRBQYO1g81jQ4zNeUyDrR6sT0Uclv8M83JMRud1whItF6GvTYi49L5FpaIsXMwsNw q7KSj6/vIn/j7Zg8VhmiLCHi0jT71O4HhxMEB6a/OvpuQE/IEKdbyFwCir9z2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668131303; a=rsa-sha256; cv=none; b=xELxgMkpdV5Ol+kxewGDBe1kM0dXP6/CjyU6Jc6FaoiHyItOD6/o64N1WWDz5rMg/ivDoE ZW8utJw/qRuf5kZCNE45P4AqunbEYSRCIuVo1k322V/kVHRQ3vVx4mqusc7mfPLy0AlI/c P4hr86ZfAuCvXoliW4I48esdJs4neXcMay9c5cAFJqAF+0herSM8KFLE/xh8cPHUgEMb/I +dderbaLdYcO6TdVjCom9osoQ+cO86nHBUBRZoQZX0Ckv+wbZD40k9QFa7waRrdiQ12o34 D/WIyX2lT/7SpQ9l4Z4y2Qa8ZITrFsjq0hw8RLRqIT/4im82lKcEnNaorhHVVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N7hS65MmszNdd; Fri, 11 Nov 2022 01:48:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AB1mMiE056505; Fri, 11 Nov 2022 01:48:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AB1mMr6056504; Fri, 11 Nov 2022 01:48:22 GMT (envelope-from git) Date: Fri, 11 Nov 2022 01:48:22 GMT Message-Id: <202211110148.2AB1mMr6056504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 454601155778 - stable/13 - cxgbe(4): Fix potential integer overflow in t4_tstmp_to_ns. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 454601155778939f81ebcbfb4a876ddb793a2604 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=454601155778939f81ebcbfb4a876ddb793a2604 commit 454601155778939f81ebcbfb4a876ddb793a2604 Author: Navdeep Parhar AuthorDate: 2022-09-22 15:57:25 +0000 Commit: John Baldwin CommitDate: 2022-11-11 01:26:17 +0000 cxgbe(4): Fix potential integer overflow in t4_tstmp_to_ns. Coverity flagged this in its latest run but it is not a problem in practice as the card's core clock would have to be > 4.2GHz for any overflow to occur. CID 1498303: Integer handling issues (OVERFLOW_BEFORE_WIDEN) Potentially overflowing expression "sc->params.vpd.cclk * 1000U" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned). Reported by: Coverity Scan (CID 1498303) Sponsored by: Chelsio Communications (cherry picked from commit 02fac928ab687607786801cdf33f100c70cc6a2e) --- sys/dev/cxgbe/t4_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index dd3d22020651..48d87be4e0b6 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -1552,7 +1552,7 @@ t4_tstmp_to_ns(struct adapter *sc, uint64_t lf) * Note that vpd.cclk is in khz, we need it in raw hz so * convert to hz. */ - cclk = sc->params.vpd.cclk * 1000; + cclk = (uint64_t)sc->params.vpd.cclk * 1000; hw_clocks = hw_tstmp - dcur.hw_prev; tstmp_sec = hw_clocks / cclk; tstmp_nsec = hw_clocks % cclk;