All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] microvm: fix Coverity warnings
@ 2021-11-08 13:07 Gerd Hoffmann
  2021-11-08 13:07 ` [PATCH 1/2] microvm: add missing g_free() call Gerd Hoffmann
  2021-11-08 13:07 ` [PATCH 2/2] microvm: check g_file_set_contents() return value Gerd Hoffmann
  0 siblings, 2 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-11-08 13:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael S. Tsirkin, Richard Henderson,
	Gerd Hoffmann, Paolo Bonzini



Gerd Hoffmann (2):
  microvm: add missing g_free() call
  microvm: check g_file_set_contents() return value

 hw/i386/microvm-dt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] microvm: add missing g_free() call
  2021-11-08 13:07 [PATCH 0/2] microvm: fix Coverity warnings Gerd Hoffmann
@ 2021-11-08 13:07 ` Gerd Hoffmann
  2021-11-08 14:43   ` Philippe Mathieu-Daudé
  2021-11-08 13:07 ` [PATCH 2/2] microvm: check g_file_set_contents() return value Gerd Hoffmann
  1 sibling, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2021-11-08 13:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael S. Tsirkin, Richard Henderson,
	Gerd Hoffmann, Paolo Bonzini

Fixes: CID 1465240
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/microvm-dt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index 875ba9196394..ad4e48e5fe60 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -143,6 +143,8 @@ static void dt_add_pcie(MicrovmMachineState *mms)
     nr_pcie_buses = PCIE_ECAM_SIZE / PCIE_MMCFG_SIZE_MIN;
     qemu_fdt_setprop_cells(mms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
+
+    g_free(nodename);
 }
 
 static void dt_add_ioapic(MicrovmMachineState *mms, SysBusDevice *dev)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] microvm: check g_file_set_contents() return value
  2021-11-08 13:07 [PATCH 0/2] microvm: fix Coverity warnings Gerd Hoffmann
  2021-11-08 13:07 ` [PATCH 1/2] microvm: add missing g_free() call Gerd Hoffmann
@ 2021-11-08 13:07 ` Gerd Hoffmann
  2021-11-08 15:35   ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2021-11-08 13:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Michael S. Tsirkin, Richard Henderson,
	Gerd Hoffmann, Paolo Bonzini

Fixes: CID 1465239
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/microvm-dt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index ad4e48e5fe60..774e0bc7fef3 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -334,7 +334,10 @@ void dt_setup_microvm(MicrovmMachineState *mms)
 
     if (debug) {
         fprintf(stderr, "%s: writing microvm.fdt\n", __func__);
-        g_file_set_contents("microvm.fdt", mms->fdt, size, NULL);
+        if (!g_file_set_contents("microvm.fdt", mms->fdt, size, NULL)) {
+            fprintf(stderr, "%s: writing microvm.fdt failed\n", __func__);
+            return;
+        }
         int ret = system("dtc -I dtb -O dts microvm.fdt");
         if (ret != 0) {
             fprintf(stderr, "%s: oops, dtc not installed?\n", __func__);
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] microvm: add missing g_free() call
  2021-11-08 13:07 ` [PATCH 1/2] microvm: add missing g_free() call Gerd Hoffmann
@ 2021-11-08 14:43   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-08 14:43 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Eduardo Habkost, Michael S. Tsirkin

On 11/8/21 14:07, Gerd Hoffmann wrote:
> Fixes: CID 1465240
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/i386/microvm-dt.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] microvm: check g_file_set_contents() return value
  2021-11-08 13:07 ` [PATCH 2/2] microvm: check g_file_set_contents() return value Gerd Hoffmann
@ 2021-11-08 15:35   ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-11-08 15:35 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, Michael S. Tsirkin, Richard Henderson, qemu-devel,
	Eduardo Habkost

On Mon, 8 Nov 2021 at 13:11, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Fixes: CID 1465239
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/i386/microvm-dt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
> index ad4e48e5fe60..774e0bc7fef3 100644
> --- a/hw/i386/microvm-dt.c
> +++ b/hw/i386/microvm-dt.c
> @@ -334,7 +334,10 @@ void dt_setup_microvm(MicrovmMachineState *mms)
>
>      if (debug) {
>          fprintf(stderr, "%s: writing microvm.fdt\n", __func__);
> -        g_file_set_contents("microvm.fdt", mms->fdt, size, NULL);
> +        if (!g_file_set_contents("microvm.fdt", mms->fdt, size, NULL)) {
> +            fprintf(stderr, "%s: writing microvm.fdt failed\n", __func__);
> +            return;
> +        }
>          int ret = system("dtc -I dtb -O dts microvm.fdt");
>          if (ret != 0) {
>              fprintf(stderr, "%s: oops, dtc not installed?\n", __func__);

Side note -- rather than invoking dtc from QEMU like this, it
would be more in line with the way other machine types deal
with debugging of autogenerated dtb files to support
"-machine dumpdtb=file.dtb" and let the end user decompile
the dtb themselves.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-08 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 13:07 [PATCH 0/2] microvm: fix Coverity warnings Gerd Hoffmann
2021-11-08 13:07 ` [PATCH 1/2] microvm: add missing g_free() call Gerd Hoffmann
2021-11-08 14:43   ` Philippe Mathieu-Daudé
2021-11-08 13:07 ` [PATCH 2/2] microvm: check g_file_set_contents() return value Gerd Hoffmann
2021-11-08 15:35   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.