Depending on the phase of the moon, this seems to be causing CI failures on 
FreeBSD.
Fortunately, valgrind catches it too, and in a fully deterministic way:

==210026== Invalid write of size 4
==210026==    at 0x5222F3: stm32l4x5_lpuart_class_init (stm32l4x5_usart.c:611)
==210026==    by 0xA499E1: object_class_foreach_tramp (object.c:1132)
==210026==    by 0x5A60BEA: g_hash_table_foreach (ghash.c:2117)
==210026==    by 0xA4A190: object_class_foreach (object.c:1154)
==210026==    by 0xA4A190: object_class_get_list (object.c:1211)
==210026==    by 0x7A5777: select_machine (vl.c:1664)
==210026==    by 0x7A5777: qemu_create_machine (vl.c:2104)
==210026==    by 0x7A5777: qemu_init (vl.c:3667)
==210026==    by 0x47E528: main (main.c:47)
==210026==  Address 0xe131340 is 0 bytes after a block of size 192 alloc'd
==210026==    at 0x4849E60: calloc (vg_replace_malloc.c:1595)
==210026==    by 0x5A79F71: g_malloc0 (gmem.c:133)
==210026==    by 0xA48E9B: type_initialize (object.c:361)
==210026==    by 0xA48E9B: type_initialize (object.c:336)
==210026==    by 0xA499E1: object_class_foreach_tramp (object.c:1132)
==210026==    by 0x5A60BEA: g_hash_table_foreach (ghash.c:2117)
==210026==    by 0xA4A190: object_class_foreach (object.c:1154)
==210026==    by 0xA4A190: object_class_get_list (object.c:1211)
==210026==    by 0x7A5777: select_machine (vl.c:1664)
==210026==    by 0x7A5777: qemu_create_machine (vl.c:2104)
==210026==    by 0x7A5777: qemu_init (vl.c:3667)
==210026==    by 0x47E528: main (main.c:47)

Cc: Arnaud Minier <arnaud.min...@telecom-paris.fr>
Cc: Inès Varhol <ines.var...@telecom-paris.fr>
Cc: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 hw/char/stm32l4x5_usart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/char/stm32l4x5_usart.c b/hw/char/stm32l4x5_usart.c
index 2627aab8324..8dbcc7e19e7 100644
--- a/hw/char/stm32l4x5_usart.c
+++ b/hw/char/stm32l4x5_usart.c
@@ -615,6 +615,7 @@ static const TypeInfo stm32l4x5_usart_types[] = {
     {
         .name           = TYPE_STM32L4X5_USART_BASE,
         .parent         = TYPE_SYS_BUS_DEVICE,
+        .class_size     = sizeof(Stm32l4x5UsartBaseClass),
         .instance_size  = sizeof(Stm32l4x5UsartBaseState),
         .instance_init  = stm32l4x5_usart_base_init,
         .class_init     = stm32l4x5_usart_base_class_init,
-- 
2.44.0


Reply via email to