summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-06-23 22:52:51 +0200
committerArnd Bergmann <arnd@arndb.de>2009-06-23 22:56:14 +0200
commit428bc597508e482cdea17b11b7b08eabd6b924a6 (patch)
tree385ff79d2158b14f8e1bb39911dbde3a9d72613f /lib
parent217a8c7b6af924379a2083439b4bb606f332e7b1 (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')
-rw-r--r--lib/checksum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/checksum.c b/lib/checksum.c
index b08c2d059024..097508732f34 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++;