mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Fleming <matt@console-pimps.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, Mike Frysinger <vapier@gentoo.org>
Subject: [PATCH] lib/checksum.c: Fix another endianess bug
Date: Fri, 25 Sep 2009 15:20:40 +0100	[thread overview]
Message-ID: <1253888440-14111-1-git-send-email-matt@console-pimps.org> (raw)

From: Matt Fleming <matthew.fleming@imgtec.com>

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.

Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com>
---
 lib/checksum.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/checksum.c b/lib/checksum.c
index b2e2fd4..c34f030 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -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++;
-- 
1.6.3.GIT


             reply	other threads:[~2009-09-25 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-25 14:20 Matt Fleming [this message]
2009-09-25 17:00 ` Mike Frysinger
2009-09-28  8:07   ` Matt Fleming
2009-09-28 20:39     ` Mike Frysinger
2009-10-24 11:59       ` Matt Fleming
2009-10-24 22:51         ` Mike Frysinger
2009-10-25 10:03           ` [PATCH] lib/checksum.c: lib/checksum: fix one more thinko Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1253888440-14111-1-git-send-email-matt@console-pimps.org \
    --to=matt@console-pimps.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®