aboutsummaryrefslogtreecommitdiffstats
path: root/lib/checksum.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-06-23 16:52:51 -0400
committerArnd Bergmann <arnd@arndb.de>2009-11-03 10:06:53 -0500
commit0a5549ed163520787f76b7515dfe9d9aa1c7ae37 (patch)
tree6ae1acec7b9414ee941682894f46818ede221ecb /lib/checksum.c
parent20c1f641bb80fb272dec959a5caabed92e5a422e (diff)
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 <vapier.adi@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'lib/checksum.c')
-rw-r--r--lib/checksum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/checksum.c b/lib/checksum.c
index b08c2d05902..097508732f3 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -57,9 +57,9 @@ static unsigned int do_csum(const unsigned char *buff, int len)
57 odd = 1 & (unsigned long) buff; 57 odd = 1 & (unsigned long) buff;
58 if (odd) { 58 if (odd) {
59#ifdef __LITTLE_ENDIAN 59#ifdef __LITTLE_ENDIAN
60 result = *buff;
61#else
62 result += (*buff << 8); 60 result += (*buff << 8);
61#else
62 result = *buff;
63#endif 63#endif
64 len--; 64 len--;
65 buff++; 65 buff++;