On 31 October 2018 at 16:00, Philippe Mathieu-Daudé <phi...@redhat.com> wrote: > > The following patch fixes this crash, but I'm not sure this is the correct > fix: > > -- >8 -- > --- a/hw/intc/exynos4210_gic.c > +++ b/hw/intc/exynos4210_gic.c > @@ -213,6 +213,8 @@ void exynos4210_init_board_irqs(Exynos4210Irq *s) > { > uint32_t grp, bit, irq_id, n; > > + memset(s->board_irqs, 0, sizeof(s->board_irqs)); > + > for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { > irq_id = 0; > if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) ||
Generally devices should be able to assume that their state structures are zero-initialized. In this case this memory comes from Exynos4210State *s = g_new(Exynos4210State, 1); in exynos4210_init(). So the quick fix for 3.1 would be to make that use g_new0(). Longer term, the code in hw/arm/exynos4210.c is implementing an SoC, but it is not doing it in what is (now) the standard way of having the SoC be a device object which contains all the relevant SoC device objects. Making it work like that would mean that the memory for the state struct would naturally be zeroed out because it would be allocated by the functions for "create me a QOM object or device". thanks -- PMM