From nobody Mon Apr 29 04:27:23 2024 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 4VSVfg2bfwz5JBpy; Mon, 29 Apr 2024 04:27: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 4VSVfg1WKsz40tl; Mon, 29 Apr 2024 04:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714364843; 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=Hfgxtt3szG8fWlG0RckBtuQ4U3fiCUSIJsf3bWsFQaE=; b=sW4qk5OVECD0375n31McaUOFYP42QjskG8IfCOzy88zVPxMp9t/oRrtJhgxx2QB+GqPlnw sRJV7l9/l7u5oNCC1fExM89Z6VxQ9bKn3gmYikHQoSE0s7zM11hq0KaJWRUkn8G8xJpSEH GqBdwrZs3kFlxkQay5h59qrtvnRkBVA7/BbteYY68sno3Gwg4L15/10mSVWkLQ79d33kis JrszWH3Kw1DRB9offjbbIjwjXB/E/oFkKZZ7dvujOqKqOBc/+BgNCPktqeUiG8rKPGHwVl ZNUq9IMEh3olQ1b6BNUjwE3D/+VCbaj8v3cuRyLDQ7NY1zNJrhgLAF82371dGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714364843; a=rsa-sha256; cv=none; b=JsUMa7uduKTqOfe0Dm9ZQZq6UY5DqAWKpbdx3ahNmfkTO8hdVqF/twcuIz0eWqU5pISPUm 7qBVvXDTrjWK7UGUiITHT3cDWhJirlgLB6Bmo5LOytD1T0pt8F4z9DSlmMp5rDJrHSPr63 u0rvS1zMVYbVTrFvmrYccupn1X9Wz+EOfp4YXM/sutxzZWGow15ffsIvmIPwWZQF0Yh0HM Qk1B1hR3hYkFmbgte8UQiKqRJXoujuqCwovir3a2WqjmfaI3a6qnEoPKAZ9D3b4zR6FvHX VGtYp3JJeu5JnmknkJbqLOTjID4hsK9bwFsZBFPVX/uFFV8+dXTNUiywRj5kTg== 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=1714364843; 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=Hfgxtt3szG8fWlG0RckBtuQ4U3fiCUSIJsf3bWsFQaE=; b=eH9FRf8+jANjosj/S9E2fX7b+MWhScyQkehdMWuLHWBD2pWRNGCsAWEc/SvT/pd3ztXjAz ul24bjvxv5PcHAqEh8Wb4qry8a3YxdZc1chiFCY4X1a2nJ7QbROUbvkUIhvQEeWaQWsxXt n4JQTbVImfYDBDkDG4YF9fWMT4zQ2gl4Kbjk85NE70GrBlI0KjVUHYQZwDm/lRSKwF8tc2 rxJrkvcBmFGLqVIF8SeZIhxFS4jgIkqnX5MDd6iDIxqxWyO3GhGt3qNLCNYC3MvMiR/O3z XehNj4Hz/vljo/B+2ItwrezRy/etCbZ0Dm7y4yy7t2x14IbEtO95dT/Mlx3iyw== 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 4VSVfg0rGVzvHW; Mon, 29 Apr 2024 04:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43T4RNIt044910; Mon, 29 Apr 2024 04:27:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43T4RNrn044907; Mon, 29 Apr 2024 04:27:23 GMT (envelope-from git) Date: Mon, 29 Apr 2024 04:27:23 GMT Message-Id: <202404290427.43T4RNrn044907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f93475cf0fd8 - main - pstat: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f93475cf0fd8a7992131a5b8c7f94372a3e44f9c Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f93475cf0fd8a7992131a5b8c7f94372a3e44f9c commit f93475cf0fd8a7992131a5b8c7f94372a3e44f9c Author: Elyes Haouas AuthorDate: 2023-11-07 17:13:32 +0000 Commit: Warner Losh CommitDate: 2024-04-29 03:30:55 +0000 pstat: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas --- usr.sbin/pstat/pstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index aab7e902cc4c..fd11c7666955 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -388,7 +388,7 @@ filemode(void) printf(sizeof(uintptr_t) == 4 ? fhdr32 : fhdr64); wid = (int)sizeof(uintptr_t) * 2; for (fp = (struct xfile *)buf, i = 0; i < openf; ++fp, ++i) { - if ((size_t)fp->xf_type >= sizeof(dtypes) / sizeof(dtypes[0])) + if ((size_t)fp->xf_type >= nitems(dtypes)) continue; (void)printf("%*jx", wid, (uintmax_t)(uintptr_t)fp->xf_file); (void)printf(" %-6.6s", dtypes[fp->xf_type]);