* Re: [PATCH] sctp: Correct type and usage of sctp_end_cksum()
[not found] <1366336498-25917-1-git-send-email-horms@verge.net.au>
@ 2013-04-19 13:10 ` Neil Horman
2013-04-25 13:12 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Neil Horman @ 2013-04-19 13:10 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, linux-sctp, netfilter-devel, Vlad Yasevich,
Pablo Neira Ayuso, Patrick McHardy
On Fri, Apr 19, 2013 at 10:54:58AM +0900, Simon Horman wrote:
> Change the type of the crc32 parameter of sctp_end_cksum()
> from __be32 to __u32 to reflect that fact that it is passed
> to cpu_to_le32().
>
> There are five in-tree users of sctp_end_cksum().
> The following four had warnings flagged by sparse which are
> no longer present with this change.
>
> net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_nat_csum()
> net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_csum_check()
> net/sctp/input.c:sctp_rcv_checksum()
> net/sctp/output.c:sctp_packet_transmit()
>
> The fifth user is net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt().
> It has been updated to pass a __u32 instead of a __be32,
> the value in question was already calculated in cpu byte-order.
>
> net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt() has also
> been updated to assign the return value of sctp_end_cksum()
> directly to a variable of type __le32, matching the
> type of the return value. Previously the return value
> was assigned to a variable of type __be32 and then that variable
> was finally assigned to another variable of type __le32.
>
> Problems flagged by sparse.
> Compile and sparse tested only.
>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> include/net/sctp/checksum.h | 2 +-
> net/netfilter/nf_nat_proto_sctp.c | 5 ++---
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
> index befc8d2..5a2110d 100644
> --- a/include/net/sctp/checksum.h
> +++ b/include/net/sctp/checksum.h
> @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
> return sctp_crc32c(crc32, buffer, length);
> }
>
> -static inline __le32 sctp_end_cksum(__be32 crc32)
> +static inline __le32 sctp_end_cksum(__u32 crc32)
> {
> return cpu_to_le32(~crc32);
> }
> diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c
> index e64faa5..396e55d 100644
> --- a/net/netfilter/nf_nat_proto_sctp.c
> +++ b/net/netfilter/nf_nat_proto_sctp.c
> @@ -36,7 +36,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> {
> struct sk_buff *frag;
> sctp_sctphdr_t *hdr;
> - __be32 crc32;
> + __u32 crc32;
>
> if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
> return false;
> @@ -55,8 +55,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> skb_walk_frags(skb, frag)
> crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
> crc32);
> - crc32 = sctp_end_cksum(crc32);
> - hdr->checksum = crc32;
> + hdr->checksum = sctp_end_cksum(crc32);
>
> return true;
> }
> --
> 1.7.10.4
>
>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sctp: Correct type and usage of sctp_end_cksum()
2013-04-19 13:10 ` [PATCH] sctp: Correct type and usage of sctp_end_cksum() Neil Horman
@ 2013-04-25 13:12 ` Simon Horman
2013-04-25 14:35 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2013-04-25 13:12 UTC (permalink / raw)
To: Neil Horman, Pablo Neira Ayuso
Cc: netdev, linux-sctp, netfilter-devel, Vlad Yasevich,
Patrick McHardy
On Fri, Apr 19, 2013 at 09:10:43AM -0400, Neil Horman wrote:
> On Fri, Apr 19, 2013 at 10:54:58AM +0900, Simon Horman wrote:
> > Change the type of the crc32 parameter of sctp_end_cksum()
> > from __be32 to __u32 to reflect that fact that it is passed
> > to cpu_to_le32().
> >
> > There are five in-tree users of sctp_end_cksum().
> > The following four had warnings flagged by sparse which are
> > no longer present with this change.
> >
> > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_nat_csum()
> > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_csum_check()
> > net/sctp/input.c:sctp_rcv_checksum()
> > net/sctp/output.c:sctp_packet_transmit()
> >
> > The fifth user is net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt().
> > It has been updated to pass a __u32 instead of a __be32,
> > the value in question was already calculated in cpu byte-order.
> >
> > net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt() has also
> > been updated to assign the return value of sctp_end_cksum()
> > directly to a variable of type __le32, matching the
> > type of the return value. Previously the return value
> > was assigned to a variable of type __be32 and then that variable
> > was finally assigned to another variable of type __le32.
> >
> > Problems flagged by sparse.
> > Compile and sparse tested only.
> >
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > ---
> > include/net/sctp/checksum.h | 2 +-
> > net/netfilter/nf_nat_proto_sctp.c | 5 ++---
> > 2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
> > index befc8d2..5a2110d 100644
> > --- a/include/net/sctp/checksum.h
> > +++ b/include/net/sctp/checksum.h
> > @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
> > return sctp_crc32c(crc32, buffer, length);
> > }
> >
> > -static inline __le32 sctp_end_cksum(__be32 crc32)
> > +static inline __le32 sctp_end_cksum(__u32 crc32)
> > {
> > return cpu_to_le32(~crc32);
> > }
> > diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c
> > index e64faa5..396e55d 100644
> > --- a/net/netfilter/nf_nat_proto_sctp.c
> > +++ b/net/netfilter/nf_nat_proto_sctp.c
> > @@ -36,7 +36,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > {
> > struct sk_buff *frag;
> > sctp_sctphdr_t *hdr;
> > - __be32 crc32;
> > + __u32 crc32;
> >
> > if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
> > return false;
> > @@ -55,8 +55,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > skb_walk_frags(skb, frag)
> > crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
> > crc32);
> > - crc32 = sctp_end_cksum(crc32);
> > - hdr->checksum = crc32;
> > + hdr->checksum = sctp_end_cksum(crc32);
> >
> > return true;
> > }
> > --
> > 1.7.10.4
> >
> >
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
Pablo, are you interested in taking this through nf-next?
Or is it more appropriate for net-next. Or should I split
it into two patches on a per-file basis, yielding one patch for each tree?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sctp: Correct type and usage of sctp_end_cksum()
2013-04-25 13:12 ` Simon Horman
@ 2013-04-25 14:35 ` Pablo Neira Ayuso
2013-04-26 0:28 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-25 14:35 UTC (permalink / raw)
To: Simon Horman
Cc: Neil Horman, netdev, linux-sctp, netfilter-devel, Vlad Yasevich,
Patrick McHardy
On Thu, Apr 25, 2013 at 10:12:14PM +0900, Simon Horman wrote:
> On Fri, Apr 19, 2013 at 09:10:43AM -0400, Neil Horman wrote:
> > On Fri, Apr 19, 2013 at 10:54:58AM +0900, Simon Horman wrote:
> > > Change the type of the crc32 parameter of sctp_end_cksum()
> > > from __be32 to __u32 to reflect that fact that it is passed
> > > to cpu_to_le32().
> > >
> > > There are five in-tree users of sctp_end_cksum().
> > > The following four had warnings flagged by sparse which are
> > > no longer present with this change.
> > >
> > > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_nat_csum()
> > > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_csum_check()
> > > net/sctp/input.c:sctp_rcv_checksum()
> > > net/sctp/output.c:sctp_packet_transmit()
> > >
> > > The fifth user is net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt().
> > > It has been updated to pass a __u32 instead of a __be32,
> > > the value in question was already calculated in cpu byte-order.
> > >
> > > net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt() has also
> > > been updated to assign the return value of sctp_end_cksum()
> > > directly to a variable of type __le32, matching the
> > > type of the return value. Previously the return value
> > > was assigned to a variable of type __be32 and then that variable
> > > was finally assigned to another variable of type __le32.
> > >
> > > Problems flagged by sparse.
> > > Compile and sparse tested only.
> > >
> > > Signed-off-by: Simon Horman <horms@verge.net.au>
> > > ---
> > > include/net/sctp/checksum.h | 2 +-
> > > net/netfilter/nf_nat_proto_sctp.c | 5 ++---
> > > 2 files changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
> > > index befc8d2..5a2110d 100644
> > > --- a/include/net/sctp/checksum.h
> > > +++ b/include/net/sctp/checksum.h
> > > @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
> > > return sctp_crc32c(crc32, buffer, length);
> > > }
> > >
> > > -static inline __le32 sctp_end_cksum(__be32 crc32)
> > > +static inline __le32 sctp_end_cksum(__u32 crc32)
> > > {
> > > return cpu_to_le32(~crc32);
> > > }
> > > diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c
> > > index e64faa5..396e55d 100644
> > > --- a/net/netfilter/nf_nat_proto_sctp.c
> > > +++ b/net/netfilter/nf_nat_proto_sctp.c
> > > @@ -36,7 +36,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > > {
> > > struct sk_buff *frag;
> > > sctp_sctphdr_t *hdr;
> > > - __be32 crc32;
> > > + __u32 crc32;
> > >
> > > if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
> > > return false;
> > > @@ -55,8 +55,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > > skb_walk_frags(skb, frag)
> > > crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
> > > crc32);
> > > - crc32 = sctp_end_cksum(crc32);
> > > - hdr->checksum = crc32;
> > > + hdr->checksum = sctp_end_cksum(crc32);
> > >
> > > return true;
> > > }
> > > --
> > > 1.7.10.4
> > >
> > >
> > Acked-by: Neil Horman <nhorman@tuxdriver.com>
>
> Pablo, are you interested in taking this through nf-next?
I'll take it. Let's see if we still reach the merge window open yet.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sctp: Correct type and usage of sctp_end_cksum()
2013-04-25 14:35 ` Pablo Neira Ayuso
@ 2013-04-26 0:28 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2013-04-26 0:28 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Neil Horman, netdev, linux-sctp, netfilter-devel, Vlad Yasevich,
Patrick McHardy
On Thu, Apr 25, 2013 at 04:35:39PM +0200, Pablo Neira Ayuso wrote:
> On Thu, Apr 25, 2013 at 10:12:14PM +0900, Simon Horman wrote:
> > On Fri, Apr 19, 2013 at 09:10:43AM -0400, Neil Horman wrote:
> > > On Fri, Apr 19, 2013 at 10:54:58AM +0900, Simon Horman wrote:
> > > > Change the type of the crc32 parameter of sctp_end_cksum()
> > > > from __be32 to __u32 to reflect that fact that it is passed
> > > > to cpu_to_le32().
> > > >
> > > > There are five in-tree users of sctp_end_cksum().
> > > > The following four had warnings flagged by sparse which are
> > > > no longer present with this change.
> > > >
> > > > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_nat_csum()
> > > > net/netfilter/ipvs/ip_vs_proto_sctp.c:sctp_csum_check()
> > > > net/sctp/input.c:sctp_rcv_checksum()
> > > > net/sctp/output.c:sctp_packet_transmit()
> > > >
> > > > The fifth user is net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt().
> > > > It has been updated to pass a __u32 instead of a __be32,
> > > > the value in question was already calculated in cpu byte-order.
> > > >
> > > > net/netfilter/nf_nat_proto_sctp.c:sctp_manip_pkt() has also
> > > > been updated to assign the return value of sctp_end_cksum()
> > > > directly to a variable of type __le32, matching the
> > > > type of the return value. Previously the return value
> > > > was assigned to a variable of type __be32 and then that variable
> > > > was finally assigned to another variable of type __le32.
> > > >
> > > > Problems flagged by sparse.
> > > > Compile and sparse tested only.
> > > >
> > > > Signed-off-by: Simon Horman <horms@verge.net.au>
> > > > ---
> > > > include/net/sctp/checksum.h | 2 +-
> > > > net/netfilter/nf_nat_proto_sctp.c | 5 ++---
> > > > 2 files changed, 3 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
> > > > index befc8d2..5a2110d 100644
> > > > --- a/include/net/sctp/checksum.h
> > > > +++ b/include/net/sctp/checksum.h
> > > > @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
> > > > return sctp_crc32c(crc32, buffer, length);
> > > > }
> > > >
> > > > -static inline __le32 sctp_end_cksum(__be32 crc32)
> > > > +static inline __le32 sctp_end_cksum(__u32 crc32)
> > > > {
> > > > return cpu_to_le32(~crc32);
> > > > }
> > > > diff --git a/net/netfilter/nf_nat_proto_sctp.c b/net/netfilter/nf_nat_proto_sctp.c
> > > > index e64faa5..396e55d 100644
> > > > --- a/net/netfilter/nf_nat_proto_sctp.c
> > > > +++ b/net/netfilter/nf_nat_proto_sctp.c
> > > > @@ -36,7 +36,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > > > {
> > > > struct sk_buff *frag;
> > > > sctp_sctphdr_t *hdr;
> > > > - __be32 crc32;
> > > > + __u32 crc32;
> > > >
> > > > if (!skb_make_writable(skb, hdroff + sizeof(*hdr)))
> > > > return false;
> > > > @@ -55,8 +55,7 @@ sctp_manip_pkt(struct sk_buff *skb,
> > > > skb_walk_frags(skb, frag)
> > > > crc32 = sctp_update_cksum((u8 *)frag->data, skb_headlen(frag),
> > > > crc32);
> > > > - crc32 = sctp_end_cksum(crc32);
> > > > - hdr->checksum = crc32;
> > > > + hdr->checksum = sctp_end_cksum(crc32);
> > > >
> > > > return true;
> > > > }
> > > > --
> > > > 1.7.10.4
> > > >
> > > >
> > > Acked-by: Neil Horman <nhorman@tuxdriver.com>
> >
> > Pablo, are you interested in taking this through nf-next?
>
> I'll take it. Let's see if we still reach the merge window open yet.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-26 0:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1366336498-25917-1-git-send-email-horms@verge.net.au>
2013-04-19 13:10 ` [PATCH] sctp: Correct type and usage of sctp_end_cksum() Neil Horman
2013-04-25 13:12 ` Simon Horman
2013-04-25 14:35 ` Pablo Neira Ayuso
2013-04-26 0:28 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).