From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD1Hi-000310-Nf for qemu-devel@nongnu.org; Fri, 23 Aug 2013 20:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VD1HY-0000jC-RR for qemu-devel@nongnu.org; Fri, 23 Aug 2013 20:00:54 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36433 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VD1HY-0000ig-Ih for qemu-devel@nongnu.org; Fri, 23 Aug 2013 20:00:44 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 24 Aug 2013 02:00:20 +0200 Message-Id: <1377302436-25193-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws Hello, Peter remarked that object_initialize() on a GICState struct field would = not check whether the TypeInfo::instance_size for its typename argument excee= ds the length of the field we're initializing. This series therefore updates all callers to explicitly pass the size available for the object. While we don't have that many object_initialize() users yet, quite a few devices are using qbus_create_inplace() or bus-specific functions based o= n it. Still I consider this the safest solution in pushing the responsability f= or supplying the length to the caller and thereby checking not only field ty= pe lengths but also allocation lengths. The series goes on to showcase an object_initialize() usage where we don'= t know the instance_size in advance and need a QOM API to obtain it. Based on Peter's OBJECT() elimination patch, which I have queued on qom-n= ext. This series conflicts with my *mpcore, virtio and ipack series among othe= rs. Regards, Andreas Cc: Peter Maydell Cc: Anthony Liguori Andreas F=C3=A4rber (16): qom: Fix object_initialize_with_type() argument name in documentation intel-hda: Pass size to hda_codec_bus_init() ipack: Pass size to ipack_bus_new_inplace() ide: Pass size to ide_bus_new() pci: Pass size to pci_bus_new_inplace() scsi: Pass size to scsi_bus_new() usb: Pass size to usb_bus_new() virtio-pci: Pass size to virtio_pci_bus_new() s390-virtio-bus: Pass size to virtio_s390_bus_new() virtio-ccw: Pass size to virtio_ccw_bus_new() virtio-mmio: Pass size to virtio_mmio_bus_new() qdev: Pass size to qbus_create_inplace() qom: Pass available size to object_initialize() qom: Introduce type_get_instance_size() qdev-monitor: Clean up qdev_device_add() variable naming qdev-monitor: Avoid aborting on out-of-memory in qdev_device_add() hw/audio/intel-hda.c | 6 +++--- hw/audio/intel-hda.h | 2 +- hw/char/ipack.c | 5 +++-- hw/char/ipack.h | 3 ++- hw/char/tpci200.c | 2 +- hw/char/virtio-serial-bus.c | 4 ++-- hw/core/qdev.c | 4 ++-- hw/core/sysbus.c | 4 ++-- hw/cpu/icc_bus.c | 3 ++- hw/dma/xilinx_axidma.c | 6 ++++-- hw/ide/ahci.c | 2 +- hw/ide/cmd646.c | 2 +- hw/ide/internal.h | 3 ++- hw/ide/isa.c | 2 +- hw/ide/macio.c | 2 +- hw/ide/mmio.c | 2 +- hw/ide/piix.c | 2 +- hw/ide/qdev.c | 5 +++-- hw/ide/via.c | 2 +- hw/intc/xics.c | 2 +- hw/misc/macio/cuda.c | 4 ++-- hw/misc/macio/macio.c | 13 +++++++------ hw/net/xilinx_axienet.c | 6 ++++-- hw/pci-host/prep.c | 4 ++-- hw/pci-host/q35.c | 2 +- hw/pci-host/versatile.c | 4 ++-- hw/pci/pci.c | 4 ++-- hw/pci/pci_bridge.c | 3 ++- hw/s390x/event-facility.c | 4 ++-- hw/s390x/s390-virtio-bus.c | 24 +++++++++++++----------- hw/s390x/virtio-ccw.c | 26 ++++++++++++++------------ hw/scsi/esp-pci.c | 2 +- hw/scsi/esp.c | 2 +- hw/scsi/lsi53c895a.c | 2 +- hw/scsi/megasas.c | 3 ++- hw/scsi/scsi-bus.c | 6 +++--- hw/scsi/spapr_vscsi.c | 3 ++- hw/scsi/virtio-scsi.c | 3 ++- hw/scsi/vmw_pvscsi.c | 3 ++- hw/usb/bus.c | 5 +++-- hw/usb/dev-smartcard-reader.c | 3 ++- hw/usb/dev-storage.c | 6 ++++-- hw/usb/dev-uas.c | 3 ++- hw/usb/hcd-ehci.c | 2 +- hw/usb/hcd-musb.c | 2 +- hw/usb/hcd-ohci.c | 2 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/hcd-xhci.c | 2 +- hw/virtio/virtio-mmio.c | 10 ++++++---- hw/virtio/virtio-pci.c | 26 ++++++++++++++------------ include/hw/pci/pci.h | 2 +- include/hw/qdev-core.h | 2 +- include/hw/scsi/scsi.h | 4 ++-- include/hw/usb.h | 3 ++- include/qom/object.h | 16 +++++++++++++--- qdev-monitor.c | 30 ++++++++++++++++++------------ qom/object.c | 16 ++++++++++++---- 57 files changed, 185 insertions(+), 132 deletions(-) --=20 1.8.1.4