qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 7474f1: qdev_try_create(): Assert that device


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 7474f1: qdev_try_create(): Assert that devices we put onto...
Date: Tue, 14 Jun 2016 08:00:08 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 7474f1be701f136b224af5e1abe55e97dc3f29a5
      
https://github.com/qemu/qemu/commit/7474f1be701f136b224af5e1abe55e97dc3f29a5
  Author: Peter Maydell <address@hidden>
  Date:   2016-06-14 (Tue, 14 Jun 2016)

  Changed paths:
    M hw/core/qdev.c

  Log Message:
  -----------
  qdev_try_create(): Assert that devices we put onto the system bus are 
SysBusDevices

If qdev_try_create() is passed NULL for the bus, it will automatically
put the newly created device onto the default system bus. However
if the device is not actually a SysBusDevice then this will result
in later crashes (for instance when running the monitor "info qtree"
command) because code reasonably assumes that all devices on the system
bus are system bus devices.

Generally the mistake is that the calling code should create the
object with object_new(TYPE_FOO) rather than qdev_create(NULL, TYPE_FOO);
see commit 6749695eaaf346c1 for an example of fixing this bug.

Assert in qdev_try_create() if the device isn't suitable to put on
the system bus, so that this mistake results in failure earlier
and more reliably.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>



reply via email to

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