From nobody Fri Feb 21 09:11:26 2025 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 4Yzkrt2Qjxz5pS5r; Fri, 21 Feb 2025 09:11:26 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yzkrt1dphz3Ydw; Fri, 21 Feb 2025 09:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740129086; 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=DpTZktd48ifIPd6lmbLRfRbFjyJ6ZMMBAu6TDmtsFhs=; b=GMTloOPFNTI/Y10tV7453lqf0nAAa/MqL/Zt93OHpY0lmELiZIq8V45N9P3Ki4MRvrHCAm diJtUzG37jlAiICZ+axHRG/HA1lK9gMVreVG1xfyX6ObCW2EltYJymC1T9kBsSZw4peUMt XQ8MpTbwQf3CX4X+moScgFhAHxQ2t1zxjh6ZgXS3MjQEjwlb713WE7DX+AL1J/0JortuHi nOK1GKtDMyTzD0bLqWLn8wxcnm+A34Jk6Cjg/G6GmRhy6jy/MWACMEYHGy1jVS9wxvSIri bl+eUrETeYMpgbHxcZ4HKFrzX8GynScqXoa62gmuI+oEV/aK27loHO/TyMu1aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740129086; a=rsa-sha256; cv=none; b=LXN58iVT49hxdB1UGypLodnsJOYZ3GaPKequALFAU6qmkR5QfWeS9ReNquizTY+uoSo6sQ B1m21W0wmrp3IAqjYMNj/892/QSPzOSDov1FWr8XbY8i617HVfAq+gC4k83ucSVDjicKAB CIVVm3owO5/Pr2G5iMbvBH05FH/7qK8ZwLdcYb76//SC8blnFwJ2mOb/jcefMT3o+AnFND linWxwdL3T2OzaTXDgRMjt2ZGXGNHpHIQ2LZMCG2L3Hb+Mc1KcUWSNVd6RiFNOVaqT7kqS xhQRsPYoT+ReU3Xk6kJKMPh25LXLgwsJ37k7PT8PIzQAGEBLGPZZMZMDqu7zlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740129086; 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=DpTZktd48ifIPd6lmbLRfRbFjyJ6ZMMBAu6TDmtsFhs=; b=TWYbj9K4osn9y+nH9aIRX9U5epY2JYR5/+KNBv738ZRJeQnd/bTnmX5PV3nLY1MZfeZCgT w3RFT8m4BXHzUy8rQl+8/d7ybHjRYpkyYOeLXsQQQx23u6qD9G5fsk98tKBrwpGp3eKTOl a7B9YF4b4j4aaHQwwz1X2pVTQIj0R1h4sdUrhOk0JJRBNL+4U17u5Em/enQG/ItCV8Cr2q 35gXriZvGXdX7xu8DwTU9uNpYoKYGer8oYtvitut3xSEbepdmaLOnq8S8j3H9MSlj12i58 WZT+ze+QJ/A30yjCHu9t2kiTwKIveB7SDOSO5BJpGGRm4mG8LbtN4X+jZcP5sw== 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 4Yzkrt1CvJz17q; Fri, 21 Feb 2025 09:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51L9BQKe086650; Fri, 21 Feb 2025 09:11:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51L9BQKB086647; Fri, 21 Feb 2025 09:11:26 GMT (envelope-from git) Date: Fri, 21 Feb 2025 09:11:26 GMT Message-Id: <202502210911.51L9BQKB086647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 207f938bc563 - main - snmp_pf: address Coverity remarks about time_t 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 207f938bc56338e6ff41e10b16610a236e1c6270 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=207f938bc56338e6ff41e10b16610a236e1c6270 commit 207f938bc56338e6ff41e10b16610a236e1c6270 Author: Kristof Provost AuthorDate: 2025-02-21 08:25:57 +0000 Commit: Kristof Provost CommitDate: 2025-02-21 08:25:57 +0000 snmp_pf: address Coverity remarks about time_t On most platforms time_t is 64 bits wide, but we assign it to 32 bits variables. Unfortunately these are SNMP fields that are defined to be 32 bits wide, so we cannot change this. We are similarly unable to prevent the passage of time, meaning that time_t must remain 64 bits wide as well. Explicitly cast to tell Coverity that we're aware of these limitations and do not wish to be reminded of them. CID: 1553869 CID: 1557025 CID: 1592232 CID: 1592234 Sponsored by: Rubicon Communications, LLC ("Netgate") --- usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c index 9f7e6d4f31cb..782e5503c8a3 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c @@ -171,7 +171,7 @@ pf_status(struct snmp_context __unused *ctx, struct snmp_value *val, case LEAF_pfStatusRuntime: runtime = (pfs->since > 0) ? time(NULL) - pfs->since : 0; - val->v.uint32 = runtime * 100; + val->v.uint32 = (uint32_t)(runtime * 100); break; case LEAF_pfStatusDebug: val->v.uint32 = pfs->debug; @@ -586,7 +586,7 @@ pf_iftable(struct snmp_context __unused *ctx, struct snmp_value *val, break; case LEAF_pfInterfacesIfTZero: val->v.uint32 = - (time(NULL) - e->pfi.pfik_tzero) * 100; + (uint32_t)(time(NULL) - e->pfi.pfik_tzero) * 100; break; case LEAF_pfInterfacesIfRefsRule: val->v.uint32 = e->pfi.pfik_rulerefs; @@ -733,7 +733,7 @@ pf_tbltable(struct snmp_context __unused *ctx, struct snmp_value *val, break; case LEAF_pfTablesTblTZero: val->v.uint32 = - (time(NULL) - e->pft.pfrts_tzero) * 100; + (uint32_t)(time(NULL) - e->pft.pfrts_tzero) * 100; break; case LEAF_pfTablesTblRefsAnchor: val->v.integer = @@ -862,7 +862,7 @@ pf_tbladdr(struct snmp_context __unused *ctx, struct snmp_value __unused *val, break; case LEAF_pfTablesAddrTZero: val->v.uint32 = - (time(NULL) - e->pfas.pfras_tzero) * 100; + (uint32_t)(time(NULL) - e->pfas.pfras_tzero) * 100; break; case LEAF_pfTablesAddrBytesInPass: val->v.counter64 =