qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size


From: Andreas Färber
Subject: [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size
Date: Sat, 24 Aug 2013 02:00:20 +0200

Hello,

Peter remarked that object_initialize() on a GICState struct field would not
check whether the TypeInfo::instance_size for its typename argument exceeds
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 on it.
Still I consider this the safest solution in pushing the responsability for
supplying the length to the caller and thereby checking not only field type
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-next.
This series conflicts with my *mpcore, virtio and ipack series among others.

Regards,
Andreas

Cc: Peter Maydell <address@hidden>
Cc: Anthony Liguori <address@hidden>

Andreas Färber (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(-)

-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]