From nobody Tue Aug 27 18:07:20 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 4Wtb9P3jN1z52ZDD; Tue, 27 Aug 2024 18:07:21 +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 4Wtb9P0pszz4ZsS; Tue, 27 Aug 2024 18:07:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724782041; 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=h26UIMmp7l8JKpCGwXnrJq3GVIz0yIMsjdxEi3Ej40k=; b=q2/YkfICDQB8ryk1sVpxaLrrAbBd1Lro74f5Uq1WdUQW4k7rwJqHgWnQQZNLV0w1KGaqtJ sXRzQOaQkirs4fHTW+XGDTBeZzp0xL6/ZiDTr3LNWBaNq2zflVZhSxQpbPpD7YlgYBM8G6 O1n2wuhiMe5YsCgvqPNjKEj9AhmB/T4EqIqcNu38jxckpKIuDHRdrHTmQliRf05YEsW6E9 8DhfMq17DBwVWOIFILP7KMQp7BVF0RQ9j/D/ICRVeB4z4P8FqXHAnjayRjUjtTXEYk4WWH DB8yURPpsOlsQmPm8QcNFEK5+UlsnMG0+LB+n7X/P0HKMsfKskZOSMZBaJTGyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724782041; a=rsa-sha256; cv=none; b=a4V26HnX86hgIyh0KnNaZas62O68RAwJklPmtnVkFmNgkKnKKQwuR1qYnepvhTAetXEa/R SjCM0wF2JwC7oFGB00RxWzGLO/fiao02Ags3t29+t6fZPQphtvnSflswYbt5WexwjHsgT3 tHc7ifsjABlLjs2ZaaZc2ftEUSrrUButHOcTbQcdE1KoYoXBXvlWW2xZSDorMopSUy47aL 8r3N/Gs8gb1sCIhcL1atxmsAfIWPHFn/j1tfGr+yXcolzoaXOmzc3VFoUiUrHt8CeyWaWe W4bBhukrfitTi/EcA+c/JPsjNVdJq10aPJ4ZH1s+6Em22TfodJtGQkxycYuKUQ== 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=1724782041; 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=h26UIMmp7l8JKpCGwXnrJq3GVIz0yIMsjdxEi3Ej40k=; b=a/NGPccfRlK8FDbXUAR/IWmA3j1zJJU76KAb1S7z/1Oc9jG7PdNnPH7NJu0h6AcxD1gAXR hNGSdA/RRcF3Ezl+s50l+FvZ7XPlWQjyjfFmiMf+wiGrJD6eBs4nTinzqJy+8SYXNqjpJO jZyXFgebsA4eHgjXa35P1xoGWKAI6OsXiuC7P95dN6+AGUcQwu34Ig56QlNb2vrVEGHkYK 4OYm+Mg2Ion6YDSKisoPbwEOI9ht4hX266BidPQ2OD4L6FdijWMC4UJoDG9kpi89Z02a+g usOosDF56fmkZG9gKYq1Kxk0Z4kftloFY5M14l6ys3bgObDMsZeQ72CTTmE5Sw== 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 4Wtb9P0R2gz10SD; Tue, 27 Aug 2024 18:07:21 +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 47RI7KT4094326; Tue, 27 Aug 2024 18:07:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47RI7Kbn094323; Tue, 27 Aug 2024 18:07:20 GMT (envelope-from git) Date: Tue, 27 Aug 2024 18:07:20 GMT Message-Id: <202408271807.47RI7Kbn094323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 52bc3fae713d - stable/14 - ctladm: Use nitems() in a few more places 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 52bc3fae713ddbec6310d842de1d8bf2cecec9af Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=52bc3fae713ddbec6310d842de1d8bf2cecec9af commit 52bc3fae713ddbec6310d842de1d8bf2cecec9af Author: John Baldwin AuthorDate: 2024-05-02 16:55:15 +0000 Commit: John Baldwin CommitDate: 2024-08-27 16:35:34 +0000 ctladm: Use nitems() in a few more places Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D45017 (cherry picked from commit afd0c206a6ce9a182c1a26a4d8dbb66a8335f519) --- usr.sbin/ctladm/ctladm.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index f06e70322708..4426274fdd44 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -2807,8 +2807,7 @@ cctl_islist_start_element(void *user_data, const char *name, const char **attr) islist = (struct cctl_islist_data *)user_data; cur_conn = islist->cur_conn; islist->level++; - if ((u_int)islist->level >= (sizeof(islist->cur_sb) / - sizeof(islist->cur_sb[0]))) + if ((u_int)islist->level >= nitems(islist->cur_sb)) errx(1, "%s: too many nesting levels, %zd max", __func__, nitems(islist->cur_sb)); @@ -3238,8 +3237,7 @@ cctl_start_element(void *user_data, const char *name, const char **attr) devlist = (struct cctl_devlist_data *)user_data; cur_lun = devlist->cur_lun; devlist->level++; - if ((u_int)devlist->level >= (sizeof(devlist->cur_sb) / - sizeof(devlist->cur_sb[0]))) + if ((u_int)devlist->level >= nitems(devlist->cur_sb)) errx(1, "%s: too many nesting levels, %zd max", __func__, nitems(devlist->cur_sb)); @@ -3502,8 +3500,7 @@ cctl_start_pelement(void *user_data, const char *name, const char **attr) portlist = (struct cctl_portlist_data *)user_data; cur_port = portlist->cur_port; portlist->level++; - if ((u_int)portlist->level >= (sizeof(portlist->cur_sb) / - sizeof(portlist->cur_sb[0]))) + if ((u_int)portlist->level >= nitems(portlist->cur_sb)) errx(1, "%s: too many nesting levels, %zd max", __func__, nitems(portlist->cur_sb));