Re: [PATCH 6/7] qemu: assume -drive argument is always available

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

 




[...]

Ran the series through the Coverity checks...

> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 79d1692..7676237 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -1104,29 +1104,27 @@ virQEMUCapsComputeCmdFlags(const char *help,
>          virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID);
>      else if (strstr(help, "-domid"))
>          virQEMUCapsSet(qemuCaps, QEMU_CAPS_DOMID);
> -    if (strstr(help, "-drive")) {
> -        const char *cache = strstr(help, "cache=");
> -
> -        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE);
> -        if (cache && (p = strchr(cache, ']'))) {
> -            if (memmem(cache, p - cache, "on|off", sizeof("on|off") - 1) == NULL)
> -                virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2);
> -            if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1))
> -                virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
> +    const char *cache = strstr(help, "cache=");
> +
> +    if (cache && (p = strchr(cache, ']'))) {
> +        if (memmem(cache, p - cache, "on|off", sizeof("on|off") - 1) == NULL)
> +            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2);
> +        if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1))
> +            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
>              if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") - 1))
>                  virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);

Coverity complains here because of indent mismatching

Looks like these two lines need to be dropped back a level

John
> -        }
> -        if (strstr(help, "format="))
> -            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT);
> -        if (strstr(help, "readonly="))
> -            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY);
> -        if (strstr(help, "aio=threads|native"))
> -            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO);
> -        if (strstr(help, "copy-on-read=on|off"))
> -            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ);
> -        if (strstr(help, "bps="))
> -            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE);
>      }
> +    if (strstr(help, "format="))
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT);
> +    if (strstr(help, "readonly="))
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_READONLY);
> +    if (strstr(help, "aio=threads|native"))
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_AIO);
> +    if (strstr(help, "copy-on-read=on|off"))
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ);
> +    if (strstr(help, "bps="))
> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE);
> +
>      if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
>          const char *nl = strstr(p, "\n");
>  

[...]

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]