[libvirt] [PATCH] qemu: Compare group_names by STRNEQ not CHECK_EQ
Peter Krempa
pkrempa at redhat.com
Mon Mar 18 11:11:17 UTC 2019
On Mon, Mar 18, 2019 at 18:27:05 +0800, Han Han wrote:
> Fix issue introduced by 047cfb05ee. Since group_name is str, use STRNEQ
> instead of CHECK_EQ to do comparition.
>
> Signed-off-by: Han Han <hhan at redhat.com>
> ---
> src/qemu/qemu_domain.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 86e80391e1..e6d0fbef04 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -9387,9 +9387,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
> CHECK_EQ(blkdeviotune.size_iops_sec,
> "blkdeviotune size_iops_sec",
> true);
> - CHECK_EQ(blkdeviotune.group_name,
> - "blkdeviotune group_name",
> - true);
> + if (disk->blkdeviotune.group_name) {
> + if (STRNEQ(disk->blkdeviotune.group_name, orig_disk->blkdeviotune.group_name)) {
This will crash in case when orig_disk->blkdeviotune.group_name is NULL.
You need to use STRNEQ_NULLABLE. It's also questionable whether we
should do anything if the new value is NULL as we can't reset the group
name, but I think it's okay to assume that it's impossible to delete the
group name at least in context of qemu.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190318/2d2cde0b/attachment-0001.sig>
More information about the libvir-list
mailing list