qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] clock-vmstate: Add missing END_OF_LIST


From: Dr. David Alan Gilbert
Subject: Re: [PATCH] clock-vmstate: Add missing END_OF_LIST
Date: Tue, 11 Jan 2022 14:01:09 +0000
User-agent: Mutt/2.1.3 (2021-09-10)

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On Tue, 11 Jan 2022 at 10:19, Dr. David Alan Gilbert (git)
> <dgilbert@redhat.com> wrote:
> >
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Add the missing VMSTATE_END_OF_LIST to vmstate_muldiv
> >
> > Fixes: 99abcbc7600 ("clock: Provide builtin multiplier/divider")
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  hw/core/clock-vmstate.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/core/clock-vmstate.c b/hw/core/clock-vmstate.c
> > index 9d9174ffbd..7eccb6d4ea 100644
> > --- a/hw/core/clock-vmstate.c
> > +++ b/hw/core/clock-vmstate.c
> > @@ -44,6 +44,7 @@ const VMStateDescription vmstate_muldiv = {
> >      .fields = (VMStateField[]) {
> >          VMSTATE_UINT32(multiplier, Clock),
> >          VMSTATE_UINT32(divider, Clock),
> > +        VMSTATE_END_OF_LIST()
> >      },
> >  };
> 
> Oops :-(
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> We could maybe make this kind of bug more likely to be detected by
> instead of having the terminator be an "all zeros" VMStateField,
> having it check both for name == NULL and for a magic number in the
> VMStateFlags field. That way (assuming something in "make check"
> causes us to do a scan through every registered vmstate struct)
> forgetting the terminator will be likely to cause us to crash or hang
> rather than finding some 0 data and thinking that's the
> terminator.

Yeh, let me see what I can come up with for that.

Dave

> thanks
> -- PMM
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK




reply via email to

[Prev in Thread] Current Thread [Next in Thread]