[libvirt] [PATCH] qemu: Properly check return value of VIR_STRDUP in qemuDomainGetBlockIoTune

Peter Krempa posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/52fb3696b4cd2ed867a31da5719b2bf24f2daeb5.1495553949.git.pkrempa@redhat.com
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] qemu: Properly check return value of VIR_STRDUP in qemuDomainGetBlockIoTune
Posted by Peter Krempa 6 years, 11 months ago
Setting the 'group_name' for a disk would falsely trigger a error path
as in commit 4b57f76502 we did not properly check the return value of
VIR_STRDUP.
---
I must have forgotten to commit this change, as I'm sure I've tested it prior
to sending the patch mentioned above.

 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6c79d4fe3..cd513ff9f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17748,7 +17748,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,

         /* Group name needs to be copied since qemuMonitorGetBlockIoThrottle
          * allocates it as well */
-        if (VIR_STRDUP(reply.group_name, disk->blkdeviotune.group_name))
+        if (VIR_STRDUP(reply.group_name, disk->blkdeviotune.group_name) < 0)
             goto endjob;
     }

-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Properly check return value of VIR_STRDUP in qemuDomainGetBlockIoTune
Posted by Jiri Denemark 6 years, 11 months ago
On Tue, May 23, 2017 at 17:40:13 +0200, Peter Krempa wrote:
> Setting the 'group_name' for a disk would falsely trigger a error path

s/a error/an error/

> as in commit 4b57f76502 we did not properly check the return value of
> VIR_STRDUP.
> ---
> I must have forgotten to commit this change, as I'm sure I've tested it prior
> to sending the patch mentioned above.
> 
>  src/qemu/qemu_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 6c79d4fe3..cd513ff9f 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -17748,7 +17748,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
> 
>          /* Group name needs to be copied since qemuMonitorGetBlockIoThrottle
>           * allocates it as well */
> -        if (VIR_STRDUP(reply.group_name, disk->blkdeviotune.group_name))
> +        if (VIR_STRDUP(reply.group_name, disk->blkdeviotune.group_name) < 0)
>              goto endjob;
>      }

ACK

Jirka

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