Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Do not try to enter more than MAX_INT16 symbols int...
details: https://anonhg.NetBSD.org/src/rev/abbc910e7b45
branches: trunk
changeset: 554995:abbc910e7b45
user: ragge <ragge%NetBSD.org@localhost>
date: Thu Nov 06 18:22:01 2003 +0000
description:
Do not try to enter more than MAX_INT16 symbols into the patricia tree;
the not-entered symbols will be found anyway but via a linear-search.
This only happens if something is wrong when linking the kernel.
Fixes problems reported on port-hp700.
diffstat:
sys/kern/kern_ksyms.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r cb3c16312d39 -r abbc910e7b45 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c Thu Nov 06 18:19:32 2003 +0000
+++ b/sys/kern/kern_ksyms.c Thu Nov 06 18:22:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ksyms.c,v 1.15 2003/10/25 09:03:59 christos Exp $ */
+/* $NetBSD: kern_ksyms.c,v 1.16 2003/11/06 18:22:01 ragge Exp $ */
/*
* Copyright (c) 2001, 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
* All rights reserved.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.15 2003/10/25 09:03:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.16 2003/11/06 18:22:01 ragge Exp $");
#ifdef _KERNEL
#include "opt_ddb.h"
@@ -241,7 +241,7 @@
ptree_gen(char *off, struct symtab *tab)
{
Elf_Sym *sym;
- int i;
+ int i, nsym;
if (off != NULL)
symb = (struct ptree *)ALIGN(off);
@@ -251,7 +251,12 @@
symb--; /* sym index won't be 0 */
sym = tab->sd_symstart;
- for (i = 1; i < tab->sd_symsize/sizeof(Elf_Sym); i++) {
+ if ((nsym = tab->sd_symsize/sizeof(Elf_Sym)) > INT16_MAX) {
+ printf("Too many symbols for tree, skipping %d symbols\n",
+ nsym-INT16_MAX);
+ nsym = INT16_MAX;
+ }
+ for (i = 1; i < nsym; i++) {
if (ELF_ST_BIND(sym[i].st_info) != STB_GLOBAL)
continue;
ptree_add(tab->sd_strstart+sym[i].st_name, i);
Home |
Main Index |
Thread Index |
Old Index