From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGEJb-00079m-4P for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:41:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGEJW-00074b-DF for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:41:42 -0400 Received: from [199.232.76.173] (port=38576 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGEJW-00074P-7D for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:41:38 -0400 Received: from g5t0009.atlanta.hp.com ([15.192.0.46]:12180) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MGEJV-0003vd-Qz for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:41:37 -0400 From: Alex Williamson Content-Type: text/plain Date: Mon, 15 Jun 2009 09:41:32 -0600 Message-Id: <1245080492.4851.29.camel@lappy> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH RESEND] bios: Fix multiple calls into smbios_load_external() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Beth Kon We're marking the used entry bitmap in smbios_load_external() for each type we check, regardless of whether we loaded anything. This makes subsequent calls behave as if we've already loaded the tables from qemu and can result in missing tables (ex. multiple type4 entries on an SMP guest). Only mark the bitmap if we actually load something. Signed-off-by: Alex Williamson -- diff --git a/bios/rombios32.c b/bios/rombios32.c index f861f81..c869798 100644 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -2554,13 +2554,14 @@ smbios_load_external(int type, char **p, unsigned *nr_structs, *max_struct_size = *p - (char *)header; } - /* Mark that we've reported on this type */ - used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f)); + if (start != *p) { + /* Mark that we've reported on this type */ + used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f)); + return 1; + } - return (start != *p); -#else /* !BX_QEMU */ +#endif /* !BX_QEMU */ return 0; -#endif } void smbios_init(void)