[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090123092449.GA27399@gondor.apana.org.au>
Date: Fri, 23 Jan 2009 20:24:49 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Vlad Yasevich <vladislav.yasevich@...com>
Cc: netdev@...r.kernel.org, linux-sctp@...r.kernel.org,
davem@...emloft.net
Subject: Re: [PATCH 1/4] sctp: Fix crc32c calculations on big-endian arhes.
On Fri, Jan 23, 2009 at 04:28:49PM +1100, Herbert Xu wrote:
>
> > > static inline __be32 sctp_end_cksum(__be32 crc32)
> > > {
> > > - return ~crc32;
> > > + return (__force __be32)~cpu_to_le32((__force u32)crc32);
> > > }
> >
> > Ouch, surely there is a better way to do this?
>
> In fact this looks wrong. Has this code actually been tested
> on big-endian?
Reading this again it does seem to do the right thing as it's
using the raw crc32c interface as opposed to crypto crc32c.
However, I suggest that we change it as follows:
1) Make sh->csum __le32 since we're using crc32c_le.
2) Change all intermediate values in sctp/checksum.h to u32.
3) Make sctp_end_cksum return __le32 and have it do
return cpu_to_le32(~crc);
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists