[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation |
Date: |
Thu, 6 May 2021 15:52:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 5/6/21 10:22 AM, Greg Kurz wrote:
> On Wed, 5 May 2021 23:10:35 +0200
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
>> Use autofree heap allocation instead of variable-length
>> array on the stack.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> hw/intc/xics.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> + g_autofree uint8_t *flags = g_malloc(ics->nr_irqs);
>
> I would have made it g_new(uint8_t, ics->nr_irqs) so that changes
> in the type of 'flags' that could potentially change the allocated
> size are safely detected.
OK, will update.
> This is unlikely though, so:
>
> Reviewed-by: Greg Kurz <groug@kaod.org>
Thanks!
- [PATCH 08/23] hw/block/nvme: Avoid dynamic stack allocation, (continued)
- [PATCH 08/23] hw/block/nvme: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 09/23] hw/net/e1000e_core: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 10/23] hw/ppc/pnv: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 12/23] hw/i386/multiboot: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 13/23] hw/usb/hcd-xhci: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 14/23] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 15/23] net: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 16/23] ui/curses: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05