From nobody Mon Apr 29 04:27:28 2024 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 4VSVfn27nnz5JBkQ; Mon, 29 Apr 2024 04:27:29 +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 4VSVfm6MQ0z41Vl; Mon, 29 Apr 2024 04:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714364848; 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=ntqfUK6dFsivwWVOwy9eD3usXsQDSPzCgghLCtvxMZ0=; b=jTNcDadx5qcbMaSR4Th5SG+asChX6GOpw52ZPrFuqaDiA0u7FOhNaZabb+OIuCvDub32Kk 4BauZohKN9lIJpmCfUCZYJgBmoayWQd0QDIFY6SiPWaBM/8CoW3qZcMzEP86K9R9Oe71iP GXTMHCXovL1sKOuCh8gAWjlOsOmwo9a2Wzcw0x2R6hkBT141qlIW7I8MYiOQ56lmWTbqvT 3LKNxVBxhxWyCLVJpVsFxnwNEs0Xxl+hs8wJ9zomY3A/JijVbpF7M1X1xc98yzW/dQHp1L Ne1qiWs5oD4mW2Acv5G9J54OkOXpYzNzjxdVzWcn2/4sti1WxW4XSNWoCggWaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714364848; a=rsa-sha256; cv=none; b=crr8l+xlmUnuu6LnANnjA31FJU9s/n/Xy4gsUXBjzrAFRnWBS6JTuxKuBCaZccTLd+V/tq F/lYjit2rABSqT1UYuU5SnhrHuUzMnsFmxp2Xn+5fYDNvwXRlCEkldC0ZvaOXadttT8Qtw kmXAZauizkxSrreGVZhAPzVnyIxCc90lGqqop3TIf88xA4m66zKHAFME0w6fOlvHwI43jN BtB5m9J0Wz5C503dgO0Xvz0idNsyezv99s0fPsg2SXnlZLMwer+JtznIgUwTVQTZeh22rc 2zN/3WWGwrKRpUrOmU0VROPss6B9ZjiwZFaKhiSsnMVQpInkijYKDOHjvzQERQ== 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=1714364848; 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=ntqfUK6dFsivwWVOwy9eD3usXsQDSPzCgghLCtvxMZ0=; b=o0qAUdxAmJ2kT37AV4z5bu1BUrxMUpvKp2ChvQSbKCQsrX2zGT5HGBF8kBeECkrsLt8B/F MLxOdRG4+iSYE0Vqa5aTzNsschbpDJ/tkTc0LUaVwCyWMZcEi0tqm5JtePG7aw6eggypcA YpAALfgjqzXlG4qW3QmzlREJlDLLO3VWht6eao/RcQ6vLvKOQR6ZOOgS8xUzXAOkUFFa/J ZbEUrlic0XG7D7f6RG5A2jivueLnSfmHmqIpqYI+XD3b8bz01Ms3xrKsPjVm4AYte3MWC4 X+0I8u1PLXLaQTUPYGNzW3PV7XJ6B6F+S1pnjaAbe3nvafYKBp9QqDVEfXIWPA== 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 4VSVfm5bymztR9; Mon, 29 Apr 2024 04:27:28 +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 43T4RSjm045143; Mon, 29 Apr 2024 04:27:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43T4RSpI045140; Mon, 29 Apr 2024 04:27:28 GMT (envelope-from git) Date: Mon, 29 Apr 2024 04:27:28 GMT Message-Id: <202404290427.43T4RSpI045140@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: c3c816173d25 - main - ipfw: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0]) 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: c3c816173d25fcb908a94c34b75fca98c5860f18 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3c816173d25fcb908a94c34b75fca98c5860f18 commit c3c816173d25fcb908a94c34b75fca98c5860f18 Author: Elyes Haouas AuthorDate: 2023-11-07 17:36:35 +0000 Commit: Warner Losh CommitDate: 2024-04-29 03:30:55 +0000 ipfw: 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 --- sbin/ipfw/dummynet.c | 4 ++-- sbin/ipfw/ipfw2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c index 9663e983b31a..6714b2af3124 100644 --- a/sbin/ipfw/dummynet.c +++ b/sbin/ipfw/dummynet.c @@ -22,7 +22,7 @@ #define NEW_AQM #include -#include +#include #include /* XXX there are several sysctl leftover here */ #include @@ -1401,7 +1401,7 @@ ipfw_config_pipe(int ac, char **av) */ if (p) p->bandwidth = -1; - for (j = 0; j < sizeof(fs->par)/sizeof(fs->par[0]); j++) + for (j = 0; j < nitems(fs->par); j++) fs->par[j] = -1; while (ac > 0) { double d; diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 72927e336fa8..51eae7e8e246 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4035,8 +4035,8 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate) rblen = *rbufsize / sizeof(uint32_t); rblen -= sizeof(struct ip_fw_rule) / sizeof(uint32_t); - ablen = sizeof(actbuf) / sizeof(actbuf[0]); - cblen = sizeof(cmdbuf) / sizeof(cmdbuf[0]); + ablen = nitems(actbuf); + cblen = nitems(cmdbuf); cblen -= F_INSN_SIZE(ipfw_insn_u32) + 1; #define CHECK_RBUFLEN(len) { CHECK_LENGTH(rblen, len); rblen -= len; }