Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Uninitialized var, found by brainy; not tested, but...



details:   https://anonhg.NetBSD.org/src/rev/afcef371e2ed
branches:  trunk
changeset: 347121:afcef371e2ed
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Aug 15 08:24:05 2016 +0000

description:
Uninitialized var, found by brainy; not tested, but obvious enough

diffstat:

 sys/arch/evbsh3/stand/mesboot/src/mesboot.c     |  4 ++--
 sys/arch/ia64/stand/common/load_elf64.c         |  6 ++++--
 sys/arch/sparc/stand/ofwboot/loadfile_machdep.c |  6 +++++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r 3eac5d12be84 -r afcef371e2ed sys/arch/evbsh3/stand/mesboot/src/mesboot.c
--- a/sys/arch/evbsh3/stand/mesboot/src/mesboot.c       Mon Aug 15 08:20:11 2016 +0000
+++ b/sys/arch/evbsh3/stand/mesboot/src/mesboot.c       Mon Aug 15 08:24:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mesboot.c,v 1.1 2010/04/06 15:54:30 nonaka Exp $       */
+/*     $NetBSD: mesboot.c,v 1.2 2016/08/15 08:32:46 maxv Exp $ */
 
 #include <macro.h>
 #include <mes2.h>
@@ -25,7 +25,7 @@
 int
 main(int argc, char **argv)
 {
-       char *kernel;
+       char *kernel = NULL;
        char *ptr, *mem, *rdptr;
        void (*func)();
        int fd, size, c;
diff -r 3eac5d12be84 -r afcef371e2ed sys/arch/ia64/stand/common/load_elf64.c
--- a/sys/arch/ia64/stand/common/load_elf64.c   Mon Aug 15 08:20:11 2016 +0000
+++ b/sys/arch/ia64/stand/common/load_elf64.c   Mon Aug 15 08:24:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: load_elf64.c,v 1.2 2006/04/22 07:58:53 cherry Exp $    */
+/*     $NetBSD: load_elf64.c,v 1.3 2016/08/15 08:24:05 maxv Exp $      */
 
 /*-
  * Copyright (c) 1998 Michael Smith <msmith%freebsd.org@localhost>
@@ -75,8 +75,10 @@
 
     marks[MARK_START] = dest;
 
-    if ((fd = loadfile(filename, marks, LOAD_KERNEL)) == -1)
+    if ((fd = loadfile(filename, marks, LOAD_KERNEL)) == -1) {
+           err = EPERM;
            goto oerr;
+    }
     close(fd);
 
     dest = marks[MARK_ENTRY];
diff -r 3eac5d12be84 -r afcef371e2ed sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
--- a/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c   Mon Aug 15 08:20:11 2016 +0000
+++ b/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c   Mon Aug 15 08:24:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: loadfile_machdep.c,v 1.14 2015/06/14 16:20:44 martin Exp $     */
+/*     $NetBSD: loadfile_machdep.c,v 1.15 2016/08/15 08:29:34 maxv Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -216,6 +216,7 @@
        phandle_t child;
        phandle_t root;
        char buf[128];
+       bool foundcpu = false;
        u_int bootcpu;
        u_int cpu;
 
@@ -236,10 +237,13 @@
                            sizeof(cpu)) == -1 && _prom_getprop(child, "portid",
                            &cpu, sizeof(cpu)) == -1)
                                panic("tlb_init: prom_getprop");
+                       foundcpu = true;
                        if (cpu == bootcpu)
                                break;
                }
        }
+       if (!foundcpu)
+               panic("tlb_init: no cpu found!");
        if (cpu != bootcpu)
                panic("tlb_init: no node for bootcpu?!?!");
        if (_prom_getprop(child, "#dtlb-entries", &dtlb_slot_max,



Home | Main Index | Thread Index | Old Index