git: 5294bfa75166 - main - sysctl_search_oid: remove all-NULL precondition

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Wed, 28 Sep 2022 09:31:54 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=5294bfa75166932497bab87a7e565d94a07341fb

commit 5294bfa75166932497bab87a7e565d94a07341fb
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2022-09-28 09:30:11 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2022-09-28 09:30:11 +0000

    sysctl_search_oid: remove all-NULL precondition
    
    The implementation of sysctl_search_oid no longer relies on the
    initial value of nodes to be all NULL, so remove the comment that
    demands it and let the caller stop enforcing it.
    
    Reviewed by:    hselasky
    Differential Revision:  https://reviews.freebsd.org/D36768
---
 sys/kern/kern_sysctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 1267ac8c9f63..8e4b69bb6eee 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -347,7 +347,7 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *oidp)
 /*
  * Locate the path to a given oid.  Returns the length of the resulting path,
  * or -1 if the oid was not found.  nodes must have room for CTL_MAXNAME
- * elements and be NULL initialized.
+ * elements.
  */
 static int
 sysctl_search_oid(struct sysctl_oid **nodes, struct sysctl_oid *needle)
@@ -401,7 +401,6 @@ sysctl_warn_reuse(const char *func, struct sysctl_oid *leaf)
 
 	sbuf_printf(&sb, "%s: can't re-use a leaf (", __func__);
 
-	memset(nodes, 0, sizeof(nodes));
 	rc = sysctl_search_oid(nodes, leaf);
 	if (rc > 0) {
 		for (i = 0; i < rc; i++)