Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Keep setting 'error' as appropriate (even if this p...
details: https://anonhg.NetBSD.org/src/rev/25a7e8a664be
branches: trunk
changeset: 330618:25a7e8a664be
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Jul 16 13:26:33 2014 +0000
description:
Keep setting 'error' as appropriate (even if this place is broken enough
to crash in many other ways...)
diffstat:
sys/kern/subr_kobj.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (91 lines):
diff -r e197980f0c58 -r 25a7e8a664be sys/kern/subr_kobj.c
--- a/sys/kern/subr_kobj.c Wed Jul 16 11:48:37 2014 +0000
+++ b/sys/kern/subr_kobj.c Wed Jul 16 13:26:33 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_kobj.c,v 1.49 2014/07/09 05:50:51 maxv Exp $ */
+/* $NetBSD: subr_kobj.c,v 1.50 2014/07/16 13:26:33 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.49 2014/07/09 05:50:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.50 2014/07/16 13:26:33 maxv Exp $");
#include "opt_modular.h"
@@ -173,7 +173,6 @@
KASSERT(ko->ko_source != NULL);
shdr = NULL;
- mapsize = 0;
error = 0;
hdr = NULL;
@@ -361,8 +360,7 @@
error = kobj_renamespace(ko->ko_symtab, ko->ko_symcnt,
&ko->ko_strtab, &ko->ko_strtabsz);
if (error != 0) {
- kobj_error(ko, "renamespace failed %d",
- error);
+ kobj_error(ko, "renamespace failed %d", error);
goto out;
}
@@ -393,6 +391,7 @@
*/
alignmask = 0;
mapbase = 0;
+ mapsize = 0;
for (i = 0; i < hdr->e_shnum; i++) {
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
@@ -414,6 +413,7 @@
*/
if (mapsize == 0) {
kobj_error(ko, "no text/data/bss");
+ error = ENOEXEC;
goto out;
}
if (ko->ko_type == KT_MEMORY) {
@@ -449,6 +449,7 @@
if (((vaddr_t)addr & alignmask) != 0) {
kobj_error(ko,
"section %d not aligned", i);
+ error = ENOEXEC;
goto out;
}
} else {
@@ -463,16 +464,15 @@
error = ko->ko_read(ko, &addr,
shdr[i].sh_size, shdr[i].sh_offset, false);
if (error != 0) {
- kobj_error(ko, "read failed %d",
- error);
+ kobj_error(ko, "read failed %d", error);
goto out;
}
} else if (ko->ko_type == KT_MEMORY &&
shdr[i].sh_size != 0) {
- kobj_error(ko, "non-loadable BSS "
+ kobj_error(ko, "non-loadable BSS "
"section in pre-loaded module");
- error = EINVAL;
- goto out;
+ error = ENOEXEC;
+ goto out;
} else {
ko->ko_progtab[pb].name = "<<NOBITS>>";
memset(addr, 0, shdr[i].sh_size);
@@ -531,8 +531,7 @@
shdr[i].sh_size,
shdr[i].sh_offset, true);
if (error != 0) {
- kobj_error(ko, "read failed %d",
- error);
+ kobj_error(ko, "read failed %d", error);
goto out;
}
}
Home |
Main Index |
Thread Index |
Old Index