[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 40/55] hw/arm/armsse: Pass correct child size to sysbus_init_
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 40/55] hw/arm/armsse: Pass correct child size to sysbus_init_child_obj() |
Date: |
Wed, 20 May 2020 16:54:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Philippe Mathieu-Daudé <address@hidden> writes:
> On 5/19/20 4:55 PM, Markus Armbruster wrote:
>> armsse_init() initializes s->armv7m[i] for all i. It passes the size
>> of the entire array instead of the array element to
>> sysbus_init_child_obj(). Harmless, but fix it anyway.
>
> Harmless because the size used to initialize the object is the one
> declared by its TypeInfo::instance_size. In this case for TYPE_ARMV7M
> it is:
>
> static const TypeInfo armv7m_info = {
> .name = TYPE_ARMV7M,
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(ARMv7MState),
Yes. object_initialize_with_type() checks @size is at least
.instance_size, and writes only up to .instance_size.
> How did you notice btw?
Transform the common, obviously sane patterns with Coccinelle, examine
the untransformed remainder. I found quite a few the bugs this way.
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Thanks!
- Re: [PATCH 24/55] ssi: ssi_create_slave_no_init() is now unused, drop, (continued)
- [PATCH 10/55] qdev: Convert uses of qdev_set_parent_bus() with Coccinelle, Markus Armbruster, 2020/05/19
- [PATCH 41/55] sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 2, Markus Armbruster, 2020/05/19
- [PATCH 14/55] pci: Convert uses of pci_create() etc. with Coccinelle, Markus Armbruster, 2020/05/19
- [PATCH 44/55] qdev: Drop qdev_realize() support for null bus, Markus Armbruster, 2020/05/19
- [PATCH 34/55] qom: Less verbose object_initialize_child(), Markus Armbruster, 2020/05/19
- [PATCH 39/55] sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 1, Markus Armbruster, 2020/05/19
- [PATCH 40/55] hw/arm/armsse: Pass correct child size to sysbus_init_child_obj(), Markus Armbruster, 2020/05/19
- [PATCH 49/55] sysbus: sysbus_init_child_obj() is now unused, drop, Markus Armbruster, 2020/05/19
- [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Markus Armbruster, 2020/05/19
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Alistair Francis, 2020/05/19
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Markus Armbruster, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Alistair Francis, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Markus Armbruster, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Paolo Bonzini, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Markus Armbruster, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Paolo Bonzini, 2020/05/20
- Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc., Markus Armbruster, 2020/05/20