>From 66522176f711bbf609e10100fb713fc3ed6101c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Thu, 7 Jul 2011 17:45:32 +0200 Subject: [PATCH] SMBIOS: use malloc_fseg() to avoid boot error on JUNOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Falling back to using malloc_high if malloc_fseg fails to support large tables e.g. due to a high number of cpus. The SMBIOS table must be allocated from low memory to prevent this bug when booting JUNOS: kernel trap 12 with interrupts disabled instruction pointer = 0x8:0xc053a6ae stack pointer = 0x10:0xc09dce7c frame pointer = 0x10:0xc09dced4 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, IOPL = 0 current process = Idle interrupt mask = net tty bio cam trap number = 30 dog: ERROR - reset of uninitialized watchdog panic: unknown/reserved trap (null)(c087aa20,c087aa20,c07ebef2,c09dcd90,5) at0 (null)(c07ebef2,1e,c09dced4,0,0) at0 (null)(c09dce3c,0,c09dcdf4,c051c108) at0 (null)(c09d0010,c09d0010,10,0,c) at0 (null)(9e0010,10,c0100010,0,9e1000) at0 (null)(2) at0 (null)(c07ecd92,f,c07d33a6,c09dcf54,ffffffff) at0 (null)(c09dcfd4,f,3,8,0) at0 (null)(9e1000,0,0,0,0) at0 (null)() at0 dog: ERROR - reset of uninitialized watchdog dog: ERROR - reset of uninitialized watchdog Uptime: 0s Signed-off-by: Bjørn Mork --- src/smbios.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/smbios.c b/src/smbios.c index 8df0f2d..5ca85cd 100644 --- a/src/smbios.c +++ b/src/smbios.c @@ -17,7 +17,10 @@ smbios_entry_point_init(u16 max_structure_size, u16 number_of_structures) { struct smbios_entry_point *ep = malloc_fseg(sizeof(*ep)); - void *finaltable = malloc_high(structure_table_length); + void *finaltable = malloc_fseg(structure_table_length); + /* fall back to malloc_high() if the table is too big */ + if (!finaltable) + finaltable = malloc_high(structure_table_length); if (!ep || !finaltable) { warn_noalloc(); free(ep); -- 1.7.2.5