diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2021-11-08 14:07:18 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-11-22 11:14:28 +0100 |
commit | b9e5628ca5d42994cc6f82752d9bf0bc98f51f64 (patch) | |
tree | 05cc138f97e259dd692f8eef152c343225fdd952 /hw | |
parent | 1b38ccc9a1fa865a8838c89216dc36df87e9c9d5 (diff) |
microvm: check g_file_set_contents() return value
Fixes: CID 1465239
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20211108130718.840216-3-kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/microvm-dt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index a6a59a6e12..9c3c4995b4 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -336,7 +336,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__); |