On Thu, May 15, 2014 at 06:57:11AM -0600, Eric Blake wrote:
> On 05/15/2014 06:26 AM, Benoît Canet wrote:
> > The Wednesday 14 May 2014 à 23:20:19 (-0400), Jeff Cody wrote :
> >> On some image chains, QEMU may not always be able to resolve the
> >> filenames properly, when updating the backing file of an image
> >> after a block commit.
> >>
>
> >> } else {
> >> commit_start(bs, base_bs, top_bs, speed, on_error, block_job_cb,
> >> bs,
> >> - &local_err);
> >> + backing_file, &local_err);
> >
> > I don't know QAPI well enough to be sure but are we certain that if
> > has_backing_file == false then backing_file == NULL and not some
> > random pointer ?
> >
> > If am thinking to add has_backing_file ? backing_file : NULL here.
>
> We are moving towards having qapi guarantee sane defaults for FOO when
> has_FOO is false; but aren't there yet. You are correct that this needs
> to guarantee that we aren't passing random memory.
>
The QAPI code generator for the QMP input marshaller initializes all
pointers to NULL, and all bools to false. If has_ is false, then the
associated pointer will also be NULL, so it is safe to just pass
backing_file.