Skip to contentSkip to conversation

stm32l4x5_usart: add missing class_size

PATCH In review Paolo Bonzini 2 participants 2 messages May 3, 2024 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stm32l4x5_usart: add missing class_size

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 <[email protected]>
Cc Inès Varhol <[email protected]>
Cc Peter Maydell <[email protected]>
---
 hw/char/stm32l4x5_usart.c | 1 +
 1 file changed, 1 insertion(+)
hw/char/stm32l4x5_usart.c +1 -0
index 2627aab8324..8dbcc7e19e7 100644
@@ -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,
Signature · 1 line
2.44.0
#1 lore raw
Quoted 41 lines · Paolo Bonzini

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 <[email protected]>
Cc Inès Varhol <[email protected]>
Cc Peter Maydell <[email protected]>
---
 hw/char/stm32l4x5_usart.c | 1 +
 1 file changed, 1 insertion(+)
hw/char/stm32l4x5_usart.c +0 -0
index 2627aab8324..8dbcc7e19e7 100644

hw/char/stm32l4x5_usart.c static const TypeInfo stm32l4x5_usart_types[] = { · line 621

Quoted 7 lines
hw/char/stm32l4x5_usart.c +1 -0
@@ -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,

This is already upstream as commit afdc29b4a3a5, I think.

thanks
-- PMM