On 22.09.25 16:45, Peter Maydell wrote:
On Fri, 19 Sept 2025 at 12:55, Daniel P. Berrangé <[email protected]> wrote:

From: Vladimir Sementsov-Ogievskiy <[email protected]>

Every caller already support errp, let's go further.

Suggested-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>

Coverity reports a bug in this change (CID 1630444):


diff --git a/chardev/char-file.c b/chardev/char-file.c
index a9e8c5e0d7..89e9cb849c 100644
--- a/chardev/char-file.c
+++ b/chardev/char-file.c
@@ -92,7 +92,11 @@ static void qmp_chardev_open_file(Chardev *chr,
          }
      }

-    qemu_chr_open_fd(chr, in, out);
+    if (!qemu_chr_open_fd(chr, in, out, errp)) {
+        qemu_close(out);
+        qemu_close(in);

Here 'in' can be -1 (if there is only an output file
and no separate input file specified), so we can
try to close(-1). Suggested fix:

          if (in >= 0) {
              qemu_close(in);
          }

Agree. I'll send a patch.


+        return;
+    }
  #endif
  }

-- PMM


--
Best regards,
Vladimir

Reply via email to