From nobody Thu Sep 22 16:50:10 2022 X-Original-To: dev-commits-src-main@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 4MYLqk6xjGz4cn00; Thu, 22 Sep 2022 16:50:10 +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 4MYLqk6RhRz3Vfc; Thu, 22 Sep 2022 16:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663865410; 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=mJHH/aNL79Q1DYT+dwBhCchIddXQbKFeFttFtMuc8zY=; b=rjNGCPSOdu+LyZetovQFeg84gHVudJkPCMQKE7VMwXvj7+feta1YIe6G6IpKXx3782XZ3T whDRYu+AH9iqwXKk2FaZjumgyGyJJZl6d4BeIdvXE0onJlV+Tk1NLnBuFAKWqnWw7Co5+1 XIOMbRx2uQHOF6QDEzs8jiDB+xq/kt77FX8jQCET1d+i8KfxdM7nC4tpIi0FFosspXjbdk OZyn1mhst0QFfOQ1nGrNp8007p8dFms996gNvdUatqJXRpWKVuUk4dvvjX/PGzgoQL5spV oUcXpz65btXBBqZUC7Smjje/1Wn6/K7Z8/PYfphOsMlqNdwOOrkZzVg/0jedIA== 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 4MYLqk5VqGzSj6; Thu, 22 Sep 2022 16:50:10 +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 28MGoAGT091491; Thu, 22 Sep 2022 16:50:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28MGoAuh091489; Thu, 22 Sep 2022 16:50:10 GMT (envelope-from git) Date: Thu, 22 Sep 2022 16:50:10 GMT Message-Id: <202209221650.28MGoAuh091489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 02fac928ab68 - main - cxgbe(4): Fix potential integer overflow in t4_tstmp_to_ns. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02fac928ab687607786801cdf33f100c70cc6a2e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663865410; 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=mJHH/aNL79Q1DYT+dwBhCchIddXQbKFeFttFtMuc8zY=; b=NNbzverx95pivUARKxUIiT2P7qD6b7dy35fP73nM0cNuCqszIqCHD9TJVaGdy87AxAl2YZ eQ8FEaOqtVBxlY1g5OVGGMGr+24xfAZRqeCO5rQW7aniWH05ciynIms5wRixyukiLKaf/C QfE/hHf9wml8C41cZeswNrSLqbdG7RA5j+iG6DpZRqgXXeAsmZnGL8D3bkb5c8uQWbYkaK eoNfNOmMPahfC8Lta1Vn58flYV/mWdluKPRPoMd9s4O5X6HKXi+DdpHAD3aMKJxX3A7eFf vtABOdJzzCZAHRb2Z5y0bcGMZIbsoulwon1phFxJUYnSJGHcFh8FUuqPaAExlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663865410; a=rsa-sha256; cv=none; b=t8DyLxmTsJ+XPnjd0uE9R1UG2XM6xoPXqQVuAmv92ur8SH3Ozct/8jAbhwiL078lt9AZSP L9KQwU6qCi1PYZ1fObp0dw3oXBz/WxBTv6S3FXHek8BN+JV0bDV0w58Eipb8c1d/zW0cRA 3NCXYBkVTgMTkCe31aCnJk9qR0cbU3izlL6T0ou8lfAla05bWa3tvmTOXKcRXi5en0kUwS beGBWLyN7DgBd6PEuzP6GK/Gb+apdvprWhlHUfSC150ll2Dr5TQC4btZ4jvKqw6u77qM+m DmIqFanB3WkgKBpHJZFw13GjbpxClO+DBmN5dtYDad51wSY6uvGyue93KnMn+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=02fac928ab687607786801cdf33f100c70cc6a2e commit 02fac928ab687607786801cdf33f100c70cc6a2e Author: Navdeep Parhar AuthorDate: 2022-09-22 15:57:25 +0000 Commit: Navdeep Parhar CommitDate: 2022-09-22 16:47:11 +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 --- 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 0dbd4e92a684..e0b73ccd8b51 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -1562,7 +1562,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;