All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-arm@nongnu.org, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch
Date: Thu, 24 May 2018 18:55:11 -0300	[thread overview]
Message-ID: <b3d15f99-2e67-c0d4-7741-3af67d566734@amsat.org> (raw)
In-Reply-To: <20180524213756.7528-1-pbonzini@redhat.com>

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\">");
> 

       reply	other threads:[~2018-05-24 21:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180524213756.7528-1-pbonzini@redhat.com>
2018-05-24 21:55 ` Philippe Mathieu-Daudé [this message]
2018-05-29 13:32   ` [Qemu-devel] [Qemu-arm] [PATCH] arm: fix malloc type mismatch Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3d15f99-2e67-c0d4-7741-3af67d566734@amsat.org \
    --to=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.