From nobody Fri Sep 30 02:04:15 2022 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 4Mdtnq5ZFqz4dfJP; Fri, 30 Sep 2022 02:04:15 +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 4Mdtnq4kQyz3fXl; Fri, 30 Sep 2022 02:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664503455; 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=ZDgVGHwwYn45ma/584crfvOIosCPHAdL7W0CLc+c4Wk=; b=isP5ZNyrrXNGVbB0xGqtXjJXicdmVhIxUdcaKTw6WBI0Gjj26k4gDvB3R48hUivAhwbVoU fOMjY4jrF0+Bd4ET0yRZ95CooCpcG+a7DGBQ1tgya2oR9iQudqjoFDSRh+r7b7579onlQv xp9yZBP9mzluX9eR/XD70rnsmoQP48pYtnO/O9Ka6KArfebVSbQTWXSvHr6aBrZOCzIAoX aKwsoyfngS+RxFQsZVqZ6oop+pnycPuey9bFbY8LG0CIUr252pSn42LTizytkNwBLXYRY2 TU8FVib5r2XA4YBsX05ejNXetk7AIk7IAjJICT8jIlp3CE3qS8gHdRvBPPdLsg== 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 4Mdtnq3qhwz11tD; Fri, 30 Sep 2022 02:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28U24FgM099242; Fri, 30 Sep 2022 02:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28U24FGH099241; Fri, 30 Sep 2022 02:04:15 GMT (envelope-from git) Date: Fri, 30 Sep 2022 02:04:15 GMT Message-Id: <202209300204.28U24FGH099241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a26c4766b029 - stable/13 - libthr: use nitems() for mib length 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a26c4766b02993b664b8934d764e36e6472c8ccc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664503455; 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=ZDgVGHwwYn45ma/584crfvOIosCPHAdL7W0CLc+c4Wk=; b=ysqiJDrBZxZVA13goCGmbr8RuVB2LME5DVAW0LgpWMRqO9i1+AkK6Nt/63iKS2Yem3t8VL oH51Ai/Qwp84NMh4TaRxe2+LSexzPucntjP6nS9OmbIAvy0gD3GxQzajBw0SH+1vw9krvk CH0Yc+qL+aNW/hWKlPhjvbFlWl2ULLUJYL3tEW0Kec9Wm/F+fcahCiNl9odqBZF5eK3wqd B/Q6L/uJJX+z1gKT9wEt30c5Az4NeQCcvSfx9Rij1F+WqlWb8ieHHE+a5dYGlS0Dw3n2JR 4nWIhvJ4Pvr3Gz+iveUf14C668EITYUWu0n5nFyHc3aPWFgiLzY72yPPYrNIcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664503455; a=rsa-sha256; cv=none; b=Fz/f+wJ9yPLiDb/IDJhFynpxPBjuvWxPTpwHonKlA/CxEvXIINO4ceR1bxefiQErCxE/yW /LEMwu9LJisO7UhXfkALdx8lQ+jG+rQ0FmDHcDwtxLaz7d8CvXGm6SEfaSslEV8Ea8CY4b gKNPM85rNxOJwgMrNPIRPhtC29s97V8HrXCRWV3GEvhXezLiRHhP4QJ+RJJwI1fBj44qjv ZpZlmy9SnulIIYcpewhI6ncMqsPJblaia3mfk9HOTetQUS8Q3rfd51qKqWl22/GbMy8sos 0Xkfnnkyt49vnE0omG64Wll99hkyHC27t55yasi7a+WfLKxgEZde1PZNez7q3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a26c4766b02993b664b8934d764e36e6472c8ccc commit a26c4766b02993b664b8934d764e36e6472c8ccc Author: Konstantin Belousov AuthorDate: 2022-09-12 20:24:55 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-30 00:29:10 +0000 libthr: use nitems() for mib length (cherry picked from commit ebf7a01594eeb8c2897d1b310069df35da112413) --- lib/libc/gen/elf_utils.c | 4 ++-- lib/libthr/thread/thr_init.c | 4 ++-- lib/libthr/thread/thr_stack.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/libc/gen/elf_utils.c b/lib/libc/gen/elf_utils.c index fbf3bf17082c..ea5cc25f8601 100644 --- a/lib/libc/gen/elf_utils.c +++ b/lib/libc/gen/elf_utils.c @@ -28,7 +28,7 @@ * $FreeBSD$ */ -#include +#include #include #include #include @@ -83,7 +83,7 @@ __libc_map_stacks_exec(void) mib[0] = CTL_KERN; mib[1] = KERN_USRSTACK; len = sizeof(usrstack); - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0) + if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0) == -1) return; if (getrlimit(RLIMIT_STACK, &rlim) == -1) diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 82bde10a153e..0ab051e57994 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" -#include +#include #include #include #include @@ -466,7 +466,7 @@ init_private(void) mib[0] = CTL_KERN; mib[1] = KERN_USRSTACK; len = sizeof (_usrstack); - if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) + if (sysctl(mib, nitems(mib), &_usrstack, &len, NULL, 0) == -1) PANIC("Cannot get kern.usrstack from sysctl"); env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN"); env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN"); diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c index b08bafdd9417..af396fe2ba93 100644 --- a/lib/libthr/thread/thr_stack.c +++ b/lib/libthr/thread/thr_stack.c @@ -30,7 +30,7 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include #include #include @@ -155,8 +155,7 @@ singlethread_map_stacks_exec(void) mib[0] = CTL_KERN; mib[1] = KERN_USRSTACK; len = sizeof(usrstack); - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0) - == -1) + if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0) == -1) return; if (getrlimit(RLIMIT_STACK, &rlim) == -1) return;