All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch
       [not found] <20180524213756.7528-1-pbonzini@redhat.com>
@ 2018-05-24 21:55 ` Philippe Mathieu-Daudé
  2018-05-29 13:32   ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-24 21:55 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-arm, qemu-devel

Cc'ing qemu-devel for patchew and co

On 05/24/2018 06:37 PM, Paolo Bonzini wrote:
> cpregs_keys is an uint32_t* so the allocation should use uint32_t.
> g_new is even better because it is type-safe.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  target/arm/gdbstub.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
> index e80cfb47c7..0c64c0292e 100644
> --- a/target/arm/gdbstub.c
> +++ b/target/arm/gdbstub.c
> @@ -157,8 +157,7 @@ int arm_gen_dynamic_xml(CPUState *cs)
>      RegisterSysregXmlParam param = {cs, s};
>  
>      cpu->dyn_xml.num_cpregs = 0;
> -    cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) *
> -                                        g_hash_table_size(cpu->cp_regs));
> +    cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs));
>      g_string_printf(s, "<?xml version=\"1.0\"?>");
>      g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">");
>      g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">");
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch
  2018-05-24 21:55 ` [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch Philippe Mathieu-Daudé
@ 2018-05-29 13:32   ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2018-05-29 13:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Paolo Bonzini, qemu-arm, qemu-devel

On 24 May 2018 at 22:55, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Cc'ing qemu-devel for patchew and co
>
> On 05/24/2018 06:37 PM, Paolo Bonzini wrote:
>> cpregs_keys is an uint32_t* so the allocation should use uint32_t.
>> g_new is even better because it is type-safe.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



Applied to target-arm.next, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-29 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180524213756.7528-1-pbonzini@redhat.com>
2018-05-24 21:55 ` [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch Philippe Mathieu-Daudé
2018-05-29 13:32   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.