On Mon, Sep 22, 2025 at 02:45:06PM +0100, 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);
>          }

Yes, that makes sense.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to