LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH net-next 4/6] ipvs: fix sparse warnings for sync msg size

To: Julian Anastasov <ja@xxxxxx>, Hans Schillstrom <hans@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH net-next 4/6] ipvs: fix sparse warnings for sync msg size
Cc: lvs-devel@xxxxxxxxxxxxxxx, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 23 Apr 2013 11:52:32 +0900
On Mon, Apr 22, 2013 at 08:39:46AM +0300, Julian Anastasov wrote:
> 
>       Hello,
> 
> On Mon, 22 Apr 2013, Simon Horman wrote:
> 
> > >   It seems v0 should be changed too,
> > > ip_vs_send_sync_msg() handles both versions in sb->mesg.
> > 
> > Thanks and sorry for missing that.
> > How about this?
> > 
> > From: Simon Horman <horms@xxxxxxxxxxxx>
> > 
> > ipvs: Use network byte order for sync message size
> > 
> > struct ip_vs_sync_mesg and ip_vs_sync_mesg_v0 are both sent across the wire
> > and used internally to store IPVS synchronisation messages.
> > 
> > Up until now the scheme used has been to convert the size field
> > to network byte order before sending a message on the wire and
> > convert it to host byte order when sending a message.
> > 
> > This patch changes that scheme to always treat the field
> > as being network byte order. This seems appropriate as
> > the structure is sent across the wire. And by consistently
> > treating the field has network byte order it is now possible
> > to take advantage of sparse to flag any future miss-use.
> > 
> > Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
> > 
> > ---
> > 
> > v2
> > * As suggested by Julian Anastasov,
> >   update struct ip_vs_sync_mesg_v0  as well as struct ip_vs_sync_mesg.
> 
>       v2 looks good,
> 
> Acked-by: Julian Anastasov <ja@xxxxxx>

[snip]

On Mon, Apr 22, 2013 at 07:55:51AM +0200, Hans Schillstrom wrote:
> Hello Simon
> 
> On Mon, 2013-04-22 at 13:05 +0900, Simon Horman wrote:
> > On Fri, Apr 19, 2013 at 10:35:04PM +0300, Julian Anastasov wrote:
> > > 
> > >   Hello,
> > > 
> > > On Fri, 19 Apr 2013, Simon Horman wrote:
> > > 
> > > > My idea is as follows:
> > > > 
> > > > From: Simon Horman <horms@xxxxxxxxxxxx>
> > > > 
> > > > ipvs: Use network byte order for sync message size
> > > > 
> > > > struct ip_vs_sync_mesg is both sent across the wire and
> > > > used internally to store IPVS synchronisation messages.
> > > > 
> > > > Up until now the scheme used has been to convert the size field
> > > > to network byte order before sending a message on the wire and
> > > > convert it to host byte order when sending a message.
> > > > 
> > > > This patch changes that scheme to always treat the field
> > > > as being network byte order. This seems appropriate as
> > > > the structure is sent across the wire. And by consistently
> > > > treating the field has network byte order it is now possible
> > > > to take advantage of sparse to flag any future miss-use.
> > > > 
> > > > Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
> > > > ---
> > > >  net/netfilter/ipvs/ip_vs_sync.c |   15 +++++----------
> > > >  1 file changed, 5 insertions(+), 10 deletions(-)
> > > > 
> > > > diff --git a/net/netfilter/ipvs/ip_vs_sync.c 
> > > > b/net/netfilter/ipvs/ip_vs_sync.c
> > > > index 8e57077..c73778a 100644
> > > > --- a/net/netfilter/ipvs/ip_vs_sync.c
> > > > +++ b/net/netfilter/ipvs/ip_vs_sync.c
> > > > @@ -255,7 +255,7 @@ struct ip_vs_sync_mesg_v0 {
> > > >  struct ip_vs_sync_mesg {
> > > >         __u8                    reserved;       /* must be zero */
> > > >         __u8                    syncid;
> > > > -       __u16                   size;
> > > > +       __be16                  size;
> > > 
> > >   It seems v0 should be changed too,
> > > ip_vs_send_sync_msg() handles both versions in sb->mesg.
> > 
> > Thanks and sorry for missing that.
> > How about this?
> > 
> > From: Simon Horman <horms@xxxxxxxxxxxx>
> > 
> > ipvs: Use network byte order for sync message size
> > 
> > struct ip_vs_sync_mesg and ip_vs_sync_mesg_v0 are both sent across the wire
> > and used internally to store IPVS synchronisation messages.
> > 
> > Up until now the scheme used has been to convert the size field
> > to network byte order before sending a message on the wire and
> > convert it to host byte order when sending a message.
> > 
> > This patch changes that scheme to always treat the field
> > as being network byte order. This seems appropriate as
> > the structure is sent across the wire. And by consistently
> > treating the field has network byte order it is now possible
> > to take advantage of sparse to flag any future miss-use.
> > 
> > Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
> 
> It looks good 
> 
> Ack-by: Hans Schillstrom <hans@xxxxxxxxxxxxxxx>

[snip]

Thanks, I have added your Acks and queued-up this this
change in ipvs-next.


--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>