Skip to contentSkip to conversation

bios: Fix multiple calls into smbios_load_external()

PATCH RESEND In review Alex Williamson 1 participant 2 messages Jun 15, 2009 – Jul 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 bios: Fix multiple calls into smbios_load_external()

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.

--

bios/rombios32.c +6 -5
index f861f81..c869798 100644
@@ -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)
#1 lore raw

Bump.

Quoted 38 lines · Alex Williamson

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.

--

bios/rombios32.c +6 -5
index f861f81..c869798 100644
@@ -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)