From nobody Tue Feb 3 22:44:22 2026 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 4f5JSk2scRz6Qrjy for ; Tue, 03 Feb 2026 22:44:22 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f5JSk0ryxz450p for ; Tue, 03 Feb 2026 22:44:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770158662; 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=Lu1CT5bF4Q9vQVgya1rsdNyn9ALXP3XprNoLd3kK0r0=; b=UyDCMl6gHdnAmzbeMZLAzIfEN0zR2fC6mp0qiIYKgF+/DbHPGQe+b99xsQ4K0g55kA0qZz ZDBxAI7IviZtIIjGQB114WtDSGZMd8gxsDoluskD/NGADhnTl0VHAzGw3EpJLUgsnwMZQj ts50dmUNfeCMM59r+awmXdoJ+alLXqAxTAASWJxU/HCFS1EgYpA04KronWHELMBR7MTc97 wRASqSMbnzqSIPG01OCAZzZ/5hTSEhGvhBWTJDZ+nX2hflGzEI/PVaucF/xDLYlv8ZrMjE UY1Vu7Zl3CU+PS6uKhI+Y519HhIMCqu0uAIDA91MmRzv7WMtXvSffsRvp/po4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770158662; a=rsa-sha256; cv=none; b=s186KBfc1tje9RUK7hpiEpiWxaAWP9pxvmLSMHNr6sp29yYUJJgJZylKQmbSauDml8SmPO A4hwHfv4rDj1KOfhpvqL0yhUKz48HniZ4bwV8ZFLPfxDV6EBwp7jTt80PLsdBm4cEiFTeI G0qD1YRuuqyGQooEQNUeW5klwEOODUQUASVQT8H8niOkRODjgzFCdt6y6+29XnpSwF63PD y8eNvtZ4WcLd5sWOIWy66toZizTDiQo/QQOmcOf4vUPf4/DHogwK+/34stI1FcxgncryBp jLS6hR9Vv57d+i2iWAguuVhxBYacaIcRyCxte56EaDq0m4zXwa0wq6lLmW9DMg== 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=1770158662; 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=Lu1CT5bF4Q9vQVgya1rsdNyn9ALXP3XprNoLd3kK0r0=; b=EjjUYX2mTqkmNFZxtdN2cw0lmEC5Zgvos6Z9Hakbes5TUMfzodcvSPISeZfh39KwG7jbou rr9tGnofxOYI21TMVsPgoOB/eTIuNXHPEek7Tsg3g8rY5tVmjvHZO9g83hkOose8LWRKJS q6Kv5vkRhzAE87KBRRLT3D0eP/jN61fzqs8Pqd57m8aAFxCwyJ3bgt8pHePvWLLyAuVEzH psmdRnGx3cU7pHIwe5hY+259vJ1bTtf8CZx56yd0gTcFNz4OFvdTjWLCrhfmeDR7u+MjsV ne0XN7ngW5gHVXzG2ZNQFKX0oZ/1tm1gC0M/7Z6IS0a3cdMisQl56xBYxhSwnw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f5JSk0QNfzYrQ for ; Tue, 03 Feb 2026 22:44:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18880 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Feb 2026 22:44:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 895e1c6567d9 - main - sysctl(9): Booleans: Fix old value length discovery 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 895e1c6567d9561c86f8d20b47e924911bce989e Auto-Submitted: auto-generated Date: Tue, 03 Feb 2026 22:44:22 +0000 Message-Id: <69827a46.18880.6ee8f9c8@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=895e1c6567d9561c86f8d20b47e924911bce989e commit 895e1c6567d9561c86f8d20b47e924911bce989e Author: Olivier Certner AuthorDate: 2026-02-03 22:25:46 +0000 Commit: Olivier Certner CommitDate: 2026-02-03 22:43:49 +0000 sysctl(9): Booleans: Fix old value length discovery When calling sysctl(3) with a null 'oldp', i.e., length discovery mode, 'oldix' can be equal to 'oldlen', and we should not fail. More generally, let SYSCTL_OUT() and SYSCTL_IN() handle corner cases, simply removing the comparisons between 'oldidx' and 'oldlen' and 'newidx' and 'newlen' done by hand as the test just after is an equality that does not require to know if 'idx' is smaller than 'len'. PR: 292917 Reported by: cy Fixes: 406da392ef8d ("sysctl(9): Booleans: Accept integers to ease knob conversion") Sponsored by: The FreeBSD Foundation --- sys/kern/kern_sysctl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index dbe509b3e8e2..be0acb0a4a55 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1637,8 +1637,6 @@ sysctl_handle_bool(SYSCTL_HANDLER_ARGS) * the output buffer, we assume that the caller expected an 'int' * instead of a 'uint8_t'. */ - if (req->oldidx >= req->oldlen) - return (ENOMEM); if (req->oldlen - req->oldidx == sizeof(int)) { int temp_int = temp; @@ -1655,8 +1653,6 @@ sysctl_handle_bool(SYSCTL_HANDLER_ARGS) * Conversely, if the input buffer has exactly 4 bytes to read, * use them all to produce a bool. */ - if (req->newidx >= req->newlen) - return (ENOMEM); if (req->newlen - req->newidx == sizeof(int)) { int temp_int;