diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2025-02-11 14:55:23 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2025-02-21 07:18:42 -0500 |
commit | 83cb18ac4500f3a14067b19408705068647cb0c5 (patch) | |
tree | 4fe8b82e1af411225465d167b293bf77a6ad371c /scripts/qapi/commands.py | |
parent | 332859dd597b78f7d1ebfaefd6195e3a2b3e5906 (diff) | |
download | qemu-83cb18ac4500f3a14067b19408705068647cb0c5.zip qemu-83cb18ac4500f3a14067b19408705068647cb0c5.tar.gz qemu-83cb18ac4500f3a14067b19408705068647cb0c5.tar.bz2 |
cryptodev/vhost: allocate CryptoDevBackendVhost using g_mem0()
The function `vhost_dev_init()` expects the `struct vhost_dev`
(passed as a parameter) to be fully initialized. This is important
because some parts of the code check whether `vhost_dev->config_ops`
is NULL to determine if it has been set (e.g. later via
`vhost_dev_set_config_notifier`).
To ensure this initialization, it’s better to allocate the entire
`CryptoDevBackendVhost` structure (which includes `vhost_dev`) using
`g_mem0()`, following the same approach used for other vhost devices,
such as in `vhost_net_init()`.
Fixes: 042cea274c ("cryptodev: add vhost-user as a new cryptodev backend")
Cc: qemu-stable@nongnu.org
Reported-by: myluo24@m.fudan.edu.cn
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20250211135523.101203-1-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'scripts/qapi/commands.py')
0 files changed, 0 insertions, 0 deletions