]> Git Repo - qemu.git/commitdiff
q800: fix coverity warning CID 1412799
authorLaurent Vivier <[email protected]>
Mon, 10 Feb 2020 13:22:52 +0000 (14:22 +0100)
committerLaurent Vivier <[email protected]>
Thu, 12 Mar 2020 15:05:48 +0000 (16:05 +0100)
Check the return value of blk_write() and log an error if any

Fixes: Coverity CID 1412799 (Error handling issues)
Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200210132252[email protected]>

hw/misc/mac_via.c

index b7d0012794a712ed65b12b3ab10f82cc8c9d4cdf..81343301b10493d65d5b8b3cbe49cc59bb959787 100644 (file)
@@ -30,6 +30,7 @@
 #include "hw/qdev-properties.h"
 #include "sysemu/block-backend.h"
 #include "trace.h"
+#include "qemu/log.h"
 
 /*
  * VIAs: There are two in every machine,
@@ -381,8 +382,10 @@ static void via2_irq_request(void *opaque, int irq, int level)
 static void pram_update(MacVIAState *m)
 {
     if (m->blk) {
-        blk_pwrite(m->blk, 0, m->mos6522_via1.PRAM,
-                   sizeof(m->mos6522_via1.PRAM), 0);
+        if (blk_pwrite(m->blk, 0, m->mos6522_via1.PRAM,
+                       sizeof(m->mos6522_via1.PRAM), 0) < 0) {
+            qemu_log("pram_update: cannot write to file\n");
+        }
     }
 }
 
This page took 0.026981 seconds and 4 git commands to generate.