From nobody Thu May 02 16:55:37 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 4VVg6d5wqDz5Jf8h; Thu, 2 May 2024 16:55:37 +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 4VVg6d5NRqz4Z1Q; Thu, 2 May 2024 16:55:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714668937; 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=KAYqxPhgVFv4S4zdjTguvR3uEYsSGTp/Sn0hlwF+E0o=; b=e1ojMXcBga2uKmOXc8hv9+oyjuK1FTuE0+SOu4AZHUQfnE35duGXAHW/sCLAfrRifLSZek g+A87IT8jjO1DI+Y+BD0yoSYBBNlXvqcrwCcYFbQrFXwoY+v6rKl/rWHTU2987JEULOGgU jFF9a52RCEbyQBtcqC9WSOs2r8uko3d6jD22JeSApV4hzq+9llnDe5t3YAGgZA3yvgwPUS I7e1RpPM3LCdTu/ECFf5vJfc7QdG59QBHXu8FKu7BKJkgLZYVOiHpL1rdcixTWs/uc1D5S KkfNvKjvOoo2HxrdW1XME18LzMQMdNUpzccwaD3jv721m4o79CtjgknXsWjJBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714668937; a=rsa-sha256; cv=none; b=ulD+zy7NZ9QU2J2F1/1SVAZ/vV07FRNVcBuYAwBXTHQKowBZPR7JTj/oc4qVRTwFErqh5m Hf7gdDla20IIAW2gLw+QMIFL91T/m5Vz9wdHOwWZ4C1gA+xXNZUWQ8RRsu+gL3vnuJDPiJ VI40SFpU84v4xGcJ+LWSHRmZ7Wq/Y5vmGfG79N9Ef/jmvjUMqIlJcDYUD5/OUxJzcdix+9 uCu1N0LHtBYORKJ+XyVLrHi5bn/Bx55HyL/+SDCYp5uxFz/+S27DAneM3UOr9UuXy8friF Hc3G6iqx2Ibp9vnW/wgu+RERej28u7YUf2Z9YnQNLIXeNSDCode7hwlbpsduxg== 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=1714668937; 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=KAYqxPhgVFv4S4zdjTguvR3uEYsSGTp/Sn0hlwF+E0o=; b=BImUbRIYPCDR3vdSEJ/KgWOSF5mcL9EdjIiVl3T6aEQyhWVqunoQ3y7MYyHkyBc2AYxpu6 L1lNC+DNo094LvVBvYk6sV2gEMJ5HUgHLCxyrlE94ESxiM1Bl2Qj5uSADCP1j963gCcMQu 8Adq03o9lVw2dCn/a8Yj6Mz1XE4xT/VAGIO1Mft0Qs1dKUg3abbshzvWJa3hUwpGPBr9il F4BgHbd9vxm0Sc5Ll8JDpRYGWC6RHBmQ/s35OpgE25yvkV3427gJSOIa5MeOVrP6iaQc73 uLUPnAXLF343PKVNeBePg21RvTlRmkzunliiEbv8Uk0ZV9muLeh9ffhBXQV9lg== 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 4VVg6d4tmvz19pc; Thu, 2 May 2024 16:55:37 +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 442GtbhW034812; Thu, 2 May 2024 16:55:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 442GtbFk034809; Thu, 2 May 2024 16:55:37 GMT (envelope-from git) Date: Thu, 2 May 2024 16:55:37 GMT Message-Id: <202405021655.442GtbFk034809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: afd0c206a6ce - main - ctladm: Use nitems() in a few more places 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afd0c206a6ce9a182c1a26a4d8dbb66a8335f519 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=afd0c206a6ce9a182c1a26a4d8dbb66a8335f519 commit afd0c206a6ce9a182c1a26a4d8dbb66a8335f519 Author: John Baldwin AuthorDate: 2024-05-02 16:55:15 +0000 Commit: John Baldwin CommitDate: 2024-05-02 16:55:15 +0000 ctladm: Use nitems() in a few more places Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D45017 --- 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 81b8d3196357..15cbf2d6cd77 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -2806,8 +2806,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)); @@ -3237,8 +3236,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)); @@ -3501,8 +3499,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));