From nobody Tue Sep 10 10:02:47 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 4X2zlr1kKlz5VHwT; Tue, 10 Sep 2024 10:02:48 +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 4X2zlr11tYz4fMC; Tue, 10 Sep 2024 10:02:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725962568; 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=Fvb4dwdz03pgzmT9lD1uknU5GP/xCK2urWekUiSSpVM=; b=pJ7ufAOSrPy2sfuXnHYGKHGtExJ6fIWAzaYG2RZD5ApkWXueM6C0rMmcaijyRG3sSyB3FE jgznNV+BDYoNzQzP335oTraY0/e9PsHOsJHN13FmnffiaxOWPROU2MMq6r/0hDLwW/K26V N3Rx2rlDez1IA6LqDjLy+LfiweurpgjQGbN2Vkx8AzxGBd5qOKcXiLzCobNq/+NV1iB5pQ OplEYOhUT3dEmsOV9a/SVs1nFKKa4qXVkf1dL8Dy1BAHZYCW5Tlm1CQRol0US5voZYlmBh Eq9wz9/zwrnja4ZZr/p7rKA5B337W2ZbSAHz/A6eJJSGygoPaXlyx6DxyPK0XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725962568; a=rsa-sha256; cv=none; b=odhQOBQt/iPm62EWo+91fCi6kkfMp70qEwQM1bdbiU/KbkaSFQBQ9FIXBKUIEkamkxHc2W scqhG7Zeh6hKOyBnjxH/A6Op5JKssx7/o/qdkGoWUdnzunzTwoO8DcdZbLO3zkItarEvSX NZEXVg3tgohxCZawt9ASk5z2f55h4KEp5wH5hmmp47JyjZaSbL7tECQjLHxuOjs+P0X87p BrCLH1LEJNiWzW4ttaE4v42iWL7UHFOlDk8GRKaiIzh7umc8FpUrY5IPk3ZpBt52tA6+od CzJO8SBR0BvFP/muwOrDrnWQF1FH7Y3JWsGjQbZKEOhj8h5jtsyAczifFO4nRw== 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=1725962568; 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=Fvb4dwdz03pgzmT9lD1uknU5GP/xCK2urWekUiSSpVM=; b=By2jUMjWEuP4x+tvtzf2/Mkfkxyb4ZA/QNiDGwAbpT44mg7LvJeHCSFybR9gJqyrxhC/PV q5BR7AzmXyLRsggVG+3qox1zjptAiVDvhntLU0lDT9wfaWF7mRx0KuUVHkx+jstE1vVk30 e3h6JhWB41m9Gyq2aN2/05InAKOBZa5NxJ1o8zvkPPqYYu7Ttp8cwys5UyqYnhO6f9hler gPOIAlk4MT0l4RnrABcYZyyeKSmmMaw3ygVtd1D72meAx8JDYhLoh5/4sYTOS8l7bTm4tX CCUlKIzKTdMkvx2+GLxrMe35syYT1p1dF46+UnhxJ2rOK6SA+TTprZPfrtCKzA== 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 4X2zlr0dvszjPx; Tue, 10 Sep 2024 10:02:48 +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 48AA2lBZ083534; Tue, 10 Sep 2024 10:02:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48AA2l4d083531; Tue, 10 Sep 2024 10:02:47 GMT (envelope-from git) Date: Tue, 10 Sep 2024 10:02:47 GMT Message-Id: <202409101002.48AA2l4d083531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 635037210ea3 - stable/14 - ndp: 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 635037210ea3e644c9d76b9627323f5ddf5dc5f5 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=635037210ea3e644c9d76b9627323f5ddf5dc5f5 commit 635037210ea3e644c9d76b9627323f5ddf5dc5f5 Author: Elyes Haouas AuthorDate: 2023-11-07 17:13:02 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-10 10:01:48 +0000 ndp: 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 (cherry picked from commit bccbb2fc4bce6c3efc1ba93f222de320db8e020a) --- usr.sbin/ndp/ndp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 4f7c32f0fdf7..56c86e447cd5 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1166,7 +1166,7 @@ rtrlist(void) size_t l; struct timeval now; - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, &l, NULL, 0) < 0) { xo_err(1, "sysctl(ICMPV6CTL_ND6_DRLIST)"); /*NOTREACHED*/ } @@ -1177,7 +1177,7 @@ rtrlist(void) xo_err(1, "malloc"); /*NOTREACHED*/ } - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &l, NULL, 0) < 0) { xo_err(1, "sysctl(ICMPV6CTL_ND6_DRLIST)"); /*NOTREACHED*/ } @@ -1252,7 +1252,7 @@ plist(void) int ninflags = opts.nflag ? NI_NUMERICHOST : 0; char namebuf[NI_MAXHOST]; - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, &l, NULL, 0) < 0) { xo_err(1, "sysctl(ICMPV6CTL_ND6_PRLIST)"); /*NOTREACHED*/ } @@ -1261,7 +1261,7 @@ plist(void) xo_err(1, "malloc"); /*NOTREACHED*/ } - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &l, NULL, 0) < 0) { xo_err(1, "sysctl(ICMPV6CTL_ND6_PRLIST)"); /*NOTREACHED*/ }