From: Arnd Bergmann Date: Tue, 23 Jun 2009 20:52:51 +0000 (+0200) Subject: lib/checksum: fix one more thinko X-Git-Tag: upstream/snapshot3+hdmi~16362^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a5549ed163520787f76b7515dfe9d9aa1c7ae37;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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. Reported-by: Mike Frysinger Signed-off-by: Arnd Bergmann --- diff --git a/lib/checksum.c b/lib/checksum.c index b08c2d0..0975087 100644 --- a/lib/checksum.c +++ b/lib/checksum.c @@ -57,9 +57,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++;