diff mbox series

stm32l4x5_usart: add missing class_size

Message ID 20240503111019.210717-1-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series stm32l4x5_usart: add missing class_size | expand

Commit Message

Paolo Bonzini May 3, 2024, 11:10 a.m. UTC
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.minier@telecom-paris.fr>
Cc: Inès Varhol <ines.varhol@telecom-paris.fr>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/stm32l4x5_usart.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Maydell May 3, 2024, 11:32 a.m. UTC | #1
On Fri, 3 May 2024 at 12:10, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> 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.minier@telecom-paris.fr>
> Cc: Inès Varhol <ines.varhol@telecom-paris.fr>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@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,

This is already upstream as commit afdc29b4a3a5, I think.

thanks
-- PMM
diff mbox series

Patch

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,