[Top][All Lists]

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

[Qemu-commits] [COMMIT dde8bbb] Warn if value of qdev_init() isn't check

From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT dde8bbb] Warn if value of qdev_init() isn't checked
Date: Thu, 08 Oct 2009 02:59:27 -0000

From: Markus Armbruster <address@hidden>

After qdev_init() fails, the device is gone.  Failure to check runs a
high risk of use-after-free.

Patchworks-ID: 35166
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/hw/qdev.h b/hw/qdev.h
index b385b25..8cd843e 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -100,7 +100,7 @@ struct CompatProperty {
 DeviceState *qdev_create(BusState *bus, const char *name);
 DeviceState *qdev_device_add(QemuOpts *opts);
-int qdev_init(DeviceState *dev);
+int qdev_init(DeviceState *dev) __attribute__((warn_unused_result));
 void qdev_init_nofail(DeviceState *dev);
 int qdev_unplug(DeviceState *dev);
 void qdev_free(DeviceState *dev);

reply via email to

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