Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fix SYSCTL_DEBUG_CREATE for non-x86 by using copyin



details:   https://anonhg.NetBSD.org/src/rev/fdb8344a8afc
branches:  trunk
changeset: 373550:fdb8344a8afc
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Feb 17 06:20:31 2023 +0000

description:
Fix SYSCTL_DEBUG_CREATE for non-x86 by using copyin

diffstat:

 sys/kern/kern_sysctl.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r bd4cb698547f -r fdb8344a8afc sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Fri Feb 17 06:14:11 2023 +0000
+++ b/sys/kern/kern_sysctl.c    Fri Feb 17 06:20:31 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.267 2023/02/17 06:14:11 skrll Exp $  */
+/*     $NetBSD: kern_sysctl.c,v 1.268 2023/02/17 06:20:31 skrll Exp $  */
 
 /*-
  * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #define __COMPAT_SYSCTL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.267 2023/02/17 06:14:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.268 2023/02/17 06:20:31 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_defcorename.h"
@@ -1228,9 +1228,16 @@
 sysctl_create(SYSCTLFN_ARGS)
 {
        const struct sysctlnode *node;
-       int k, rc, ni, nl = namelen + (name - oname);
+       int k, v, rc, ni, nl = namelen + (name - oname);
+       struct sysctlnode nnode;
 
-       node = newp;
+       if (newp == NULL)
+               return EINVAL;
+       int error = sysctl_cvt_in(l, &v, newp, newlen, &nnode);
+       if (error)
+               return error;
+
+       node = &nnode;
 
        printf("namelen %d (", nl);
        for (ni = 0; ni < nl - 1; ni++)



Home | Main Index | Thread Index | Old Index