From nobody Tue Feb 3 23:38:16 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 4f5Kfz2lPvz6Qvp8; Tue, 03 Feb 2026 23:38:19 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta003.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f5Kfz0Ds2z3Bmj; Tue, 03 Feb 2026 23:38:19 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4001b.ext.cloudfilter.net ([10.228.9.171]) by cmsmtp with ESMTPS id nJDTvkcV3APFJnPyMvtykE; Tue, 03 Feb 2026 23:38:18 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id nPyKv23AvX0jpnPyLvEMxz; Tue, 03 Feb 2026 23:38:18 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=FMIWBuos c=1 sm=1 tr=0 ts=698286ea a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=kj9zAlcOel0A:10 a=HzLeVaNsDn8A:10 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=JIsJQQpknA8kA4w4kt0A:9 a=CjuIK1q_8ugA:10 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy.cwsent.com [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 60986110; Tue, 03 Feb 2026 15:38:16 -0800 (PST) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 29773305; Tue, 03 Feb 2026 15:38:16 -0800 (PST) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Olivier Certner cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 895e1c6567d9 - main - sysctl(9): Booleans: Fix old value length discovery In-reply-to: <69827a46.18880.6ee8f9c8@gitrepo.freebsd.org> References: <69827a46.18880.6ee8f9c8@gitrepo.freebsd.org> Comments: In-reply-to Olivier Certner message dated "Tue, 03 Feb 2026 22:44:22 +0000." 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=us-ascii Date: Tue, 03 Feb 2026 15:38:16 -0800 Message-Id: <20260203233816.29773305@slippy.cwsent.com> X-CMAE-Envelope: MS4xfKFM23jHrY/c3Y8tuATepTGsLlEr3tx7HVsR3GHE5mBvnqMc5UrlZ/SkkXkWMzH5IxPXTpDQZcaa6P7h1S/USk6iXqpirn0V3rC+0jLiK4/LgiEHQHZb AzeYhROeJdSgSUxGSPDrJFcWDZV2eGDzsnzZ0BaVJW5hIHiyWbLNVzrYFxo/WDijp4LnGfNassOAaDBwTAmnscLhnm+B1OsHnfwxt+8r/9NG5xyesiWUDnol GWtTXePlQwjFiqCROWFpoB9qknVYgkHYh45jkSJlM2y6RrtLbF0IsGdIynlyX5GOnwkKs8nMtvKGva9OWLBOQfc4mPzMXSaSz7f4/psFPpg= X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] X-Rspamd-Queue-Id: 4f5Kfz0Ds2z3Bmj X-Spamd-Bar: ---- In message <69827a46.18880.6ee8f9c8@gitrepo.freebsd.org>, Olivier Certner write s: > The branch main has been updated by olce: > > URL: https://cgit.FreeBSD.org/src/commit/?id=895e1c6567d9561c86f8d20b47e92491 > 1bce989e > > 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 ea > se 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; > > Thank you. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e**(i*pi)+1=0