Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Invert two conditions, to fix uninitialized memory ...



details:   https://anonhg.NetBSD.org/src/rev/eb2b868217da
branches:  trunk
changeset: 457564:eb2b868217da
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jul 03 17:31:32 2019 +0000

description:
Invert two conditions, to fix uninitialized memory access. If the node is
an immediate, then the 64 bits of nnode.sysctl_data may not all be
initialized, since this is an union.

Obviously, this is harmless; but still a bug, so fix it.

diffstat:

 sys/kern/kern_sysctl.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 3b797aa483bf -r eb2b868217da sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Wed Jul 03 17:24:37 2019 +0000
+++ b/sys/kern/kern_sysctl.c    Wed Jul 03 17:31:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.263 2019/01/28 15:56:12 christos Exp $       */
+/*     $NetBSD: kern_sysctl.c,v 1.264 2019/07/03 17:31:32 maxv Exp $   */
 
 /*-
  * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.263 2019/01/28 15:56:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.264 2019/07/03 17:31:32 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_defcorename.h"
@@ -1077,8 +1077,8 @@
         */
        if (l != NULL || nnode.sysctl_func == NULL) {
                if (type != CTLTYPE_NODE &&
+                   !(flags & CTLFLAG_IMMEDIATE) &&
                    nnode.sysctl_data == NULL &&
-                   !(flags & CTLFLAG_IMMEDIATE) &&
                    own == NULL)
                        return (EINVAL);
        }



Home | Main Index | Thread Index | Old Index