Re: [RFC spice-common 2/2] ring: allow testing if a ring is initialized or not

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

 



On Thu, Jun 27, 2019 at 10:39 AM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
>
> >
> > ---
> >  common/ring.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/common/ring.h b/common/ring.h
> > index 5054193..d5eadea 100644
> > --- a/common/ring.h
> > +++ b/common/ring.h
> > @@ -50,6 +50,11 @@ static inline int ring_is_empty(Ring *ring)
> >      return ring == ring->next;
> >  }
> >
> > +static inline int ring_is_initialized(Ring *ring)
> > +{
> > +    return ring->next != NULL && ring->prev != NULL;
> > +}
> > +
> >  static inline void ring_add(Ring *ring, RingItem *item)
> >  {
> >      spice_assert(ring->next != NULL && ring->prev != NULL);
>
> Hi,
>   all variables should be initialized, if not I would
> abort().
> If you want instead to check if the Ring contains element
> you can use ring_is_empty.

Hello,

as discussed in IRC, there is a bug in spice-server that exposes
uninitialized ring structures to display_channel_set_* functions,
so this patch becomes unnecessary when the bug is solved


Kevin
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]