lib/checksum.c: Fix another endianess bug
PATCH 1/1 lib/checksum.c: Fix another endianess bug
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
--- lib/checksum.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
lib/checksum.c +2 -2
@@ -55,10 +55,10 @@ static unsigned int do_csum(const unsigned char *buff, int len) goto out; odd =1 & (unsigned long ) buff;if (odd) { -#ifdef __LITTLE_ENDIAN +#ifdef __BIG_ENDIAN result = *buff;#else - result += (*buff <<8 ); + result = (*buff <<8 );#endif len--; buff++;
Signature · 1 line
1.6.3.GIT
Quoted 5 lines · Matt Fleming
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
can you try this one ?
http://lkml.org/lkml/2009/6/23/597
-mike
Quoted 10 lines · Mike Frysinger
Quoted 5 lines · Matt Fleming
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
can you try this one ?
http://lkml.org/lkml/2009/6/23/597
-mike
Yep, that one works fine also. Thanks, Mike. Who's going to pick this up? I'm guessing this commit is also applicable for stable? Though, I don't know if there are any little-endian users of this code in stable.
Quoted 8 lines · Matt Fleming
Quoted 7 lines · Mike Frysinger
Quoted 5 lines · Matt Fleming
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
Quoted 6 lines
Quoted 2 lines
can you try this one ?
http://lkml.org/lkml/2009/6/23/597Yep, that one works fine also. Thanks, Mike. Who's going to pick this up? I'm guessing this commit is also applicable for stable? Though, I don't know if there are any little-endian users of this code in stable.
i'm converting Blackfin to it now that the LE issues should be fixed, but i'm going to hold off on pushing the change until it can be tested
as for picking up the fix, let's ask Andrew ...
-mike
Quoted 16 lines · Mike Frysinger
Quoted 8 lines · Matt Fleming
Quoted 7 lines · Mike Frysinger
Quoted 5 lines · Matt Fleming
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
Quoted 6 lines
Quoted 2 lines
can you try this one ?
http://lkml.org/lkml/2009/6/23/597Yep, that one works fine also. Thanks, Mike. Who's going to pick this up? I'm guessing this commit is also applicable for stable? Though, I don't know if there are any little-endian users of this code in stable.
Quoted 5 lines
i'm converting Blackfin to it now that the LE issues should be fixed, but i'm going to hold off on pushing the change until it can be tested
as for picking up the fix, let's ask Andrew ...
-mike
Ping?
Andrew, Arnd, could one of you pick this up?
Quoted 17 lines · Matt Fleming
Quoted 16 lines · Mike Frysinger
Quoted 14 lines · Matt Fleming
Quoted 9 lines · Mike Frysinger
Quoted 5 lines · Matt Fleming
From: Matt Fleming <[email protected]>
This fix allows the generic checksum code to work on my little endian system. The previous fix was not enough, as "buff" is a big-endian value. Without this patch I see malformed TCP packets.
can you try this one ?
http://lkml.org/lkml/2009/6/23/597Yep, that one works fine also. Thanks, Mike. Who's going to pick this up? I'm guessing this commit is also applicable for stable? Though, I don't know if there are any little-endian users of this code in stable.
Quoted 8 lines
Quoted 4 lines
i'm converting Blackfin to it now that the LE issues should be fixed, but i'm going to hold off on pushing the change until it can be tested
as for picking up the fix, let's ask Andrew ...
Ping?
Andrew, Arnd, could one of you pick this up?
we've been using the generic checksum code with this fix on Blackfin boards for the last month and havent noticed any regressions so far
...
-mike
PATCH 1/1 lib/checksum.c: lib/checksum: fix one more thinko
When do_csum gets unaligned data, we really need to treat the first byte as an even byte, not an odd byte, because we swap the two halves later.
Found by Mike's checksum-selftest module.
---
Quoted 4 lines · Mike Frysinger
Quoted 1 line
Andrew, Arnd, could one of you pick this up?
we've been using the generic checksum code with this fix on Blackfin boards for the last month and havent noticed any regressions so far
Mike,
sorry for my unresponsiveness on this one. I kept procrastinating because I knew I need some to look at the whole logic again to make sure I really get it right this time.
Andrew,
can you pick this one up to make sure we don't lose it again? I could also put it into the asm-generic tree, but it feels out of place there.
Arnd <><
lib/checksum.c +2 -2
@@ -56,9 +56,9 @@ static unsigned int do_csum(const unsigned char *buff, int len) odd =1 & (unsigned long ) buff;if (odd) {#ifdef __LITTLE_ENDIAN - result = *buff; -#else result += (*buff <<8 ); +#else + result = *buff;#endif len--; buff++;