Re: [PATCH spice-server] reds: Send link replies with less chunks

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

 



On Mon, Mar 06, 2017 at 11:36:16AM -0500, Frediano Ziglio wrote:
> 
> > 
> > On Mon, Mar 06, 2017 at 04:12:33PM +0000, Frediano Ziglio wrote:
> > > Send header and reply together
> > 
> > The log is missing a "Why?"
> > 
> 
> Potentially to safe up to 160 bytes!

And this is not worth mentioning in the log because .. ?

> 
> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > > ---
> > >  server/reds.c | 56
> > >  +++++++++++++++++++++++++++++---------------------------
> > >  1 file changed, 29 insertions(+), 27 deletions(-)
> > > 
> > > diff --git a/server/reds.c b/server/reds.c
> > > index fc720a3..e94d0c4 100644
> > > --- a/server/reds.c
> > > +++ b/server/reds.c
> > > @@ -1459,8 +1459,10 @@ static bool red_link_info_test_capability(const
> > > RedLinkInfo *link, uint32_t cap)
> > >  
> > >  static int reds_send_link_ack(RedsState *reds, RedLinkInfo *link)
> > >  {
> > > -    SpiceLinkHeader header;
> > > -    SpiceLinkReply ack;
> > > +    struct {
> > > +        SpiceLinkHeader header;
> > > +        SpiceLinkReply ack;
> > > +    } msg;
> > 
> > I guess the compiler could decide to insert some padding between the 2
> > structs? If this happens, is this going to break the client/server
> > communication?
> > 
> > Christophe
> > 
> 
> I can copy the same paranoid check:
> 
> SPICE_VERIFY(sizeof(msg) == sizeof(SpiceLinkHeader) + sizeof(SpiceLinkReply));
> 
> Note that these structures are packed ones so compiler would
> break its ABI.

The anonymous struct you introduce is not packed, I don't expect the
packed attribute to apply to it. But yes, best to have the static
assert.

Christophe

Attachment: signature.asc
Description: PGP signature

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

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