Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Remove this (symtabindex == -1) check; it is alread...



details:   https://anonhg.NetBSD.org/src/rev/a273b6975301
branches:  trunk
changeset: 797125:a273b6975301
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jul 06 15:35:32 2014 +0000

description:
Remove this (symtabindex == -1) check; it is already handled by (nsym != 1).
Put a KASSERT instead.

diffstat:

 sys/kern/subr_kobj.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (47 lines):

diff -r 594db6580347 -r a273b6975301 sys/kern/subr_kobj.c
--- a/sys/kern/subr_kobj.c      Sun Jul 06 15:22:31 2014 +0000
+++ b/sys/kern/subr_kobj.c      Sun Jul 06 15:35:32 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kobj.c,v 1.47 2014/07/06 15:22:31 maxv Exp $      */
+/*     $NetBSD: subr_kobj.c,v 1.48 2014/07/06 15:35:32 maxv Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.47 2014/07/06 15:22:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.48 2014/07/06 15:35:32 maxv Exp $");
 
 #include "opt_modular.h"
 
@@ -244,8 +244,7 @@
         * Scan the section header for information and table sizing.
         */
        nsym = 0;
-       symtabindex = -1;
-       symstrindex = -1;
+       symtabindex = symstrindex = -1;
        for (i = 0; i < hdr->e_shnum; i++) {
                switch (shdr[i].sh_type) {
                case SHT_PROGBITS:
@@ -282,6 +281,7 @@
                error = ENOEXEC;
                goto out;
        }
+       KASSERT(symtabindex != -1);
        if (symstrindex < 0 || symstrindex > hdr->e_shnum ||
            shdr[symstrindex].sh_type != SHT_STRTAB) {
                kobj_error(ko, "file has invalid symbol strings");
@@ -319,10 +319,6 @@
                        goto out;
                }
        }
-       if (symtabindex == -1) {
-               kobj_error(ko, "lost symbol table index");
-               goto out;
-       }
 
        /*
         * Allocate space for and load the symbol table.



Home | Main Index | Thread Index | Old Index