aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2009-10-07 01:16:00 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-07 08:54:55 -0500
commitdde8bbb44de41ea68f9bede0a6a778ce046b2bcf (patch)
tree19331faf157f1c594fdba7ef9393b65142994bc7
parent3f66aa9c07d6392757f9d7b83849c7f791981725 (diff)
Warn if value of qdev_init() isn't checked
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 <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/qdev.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index b385b25b46..8cd843e763 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);