[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-ppc] [PATCH] target-ppc: Fix overallocation of
From: |
Tom Musta |
Subject: |
Re: [Qemu-trivial] [Qemu-ppc] [PATCH] target-ppc: Fix overallocation of opcode tables |
Date: |
Wed, 19 Mar 2014 10:14:00 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 3/19/2014 9:07 AM, Stuart Brady wrote:
> create_new_table() should allocate 0x20 opc_handler_t pointers, but
> actually allocates 0x20 opc_handler_t structs. Fix this.
>
> Signed-off-by: Stuart Brady <address@hidden>
> ---
> translate_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 6084f40..75f34c1 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -7434,7 +7434,7 @@ static int create_new_table (opc_handler_t **table,
> unsigned char idx)
> {
> opc_handler_t **tmp;
>
> - tmp = g_malloc(0x20 * sizeof(opc_handler_t));
> + tmp = g_new(opc_handler_t *, 0x20);
> fill_new_table(tmp, 0x20);
> table[idx] = (opc_handler_t *)((uintptr_t)tmp | PPC_INDIRECT);
>
Reviewed-by: Tom Musta <address@hidden>
Tested-by: Tom Musta <address@hidden>