Re: [PATCH 2/4] migration: Introduce VMStateOffset

Peter Xu <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On Thu, Jul 30, 2026 at 10:35:41AM -0400, Michael S. Tsirkin wrote:
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index 34dd06f9f73..a272bcfd0b4 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -873,14 +873,14 @@ static void vmstate_check(const VMStateDescription *vmsd)
> >                       * Size must be provided because dest QEMU needs that
> >                       * info to know what to allocate
> >                       */
> > -                    assert(field->size || field->size_offset);
> > +                    assert(field->size || field->size_offset.size != 0);
> 
> Why is field->size checked by coersing it to bool, but
> field->size_offset.size - by comparison to 0?
> field->size != 0 for consistency?

Indeed it might be better to add a comment, but for another reason: IIUC
old code was wrong.. size_offset can be 0 if the size field is the 1st
element.. so this may have fixed a bug.

-- 
Peter Xu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.