From: Linus Torvalds <torvalds@linux-foundation.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
Mike Frysinger <vapier@gentoo.org>,
Paul Mundt <lethal@linux-sh.org>,
Magnus Damm <magnus.damm@gmail.com>
Subject: Re: [GIT PULL] asm-generic fixes
Date: Tue, 23 Jun 2009 11:33:56 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0906231126460.3240@localhost.localdomain> (raw)
In-Reply-To: <200906231720.38105.arnd@arndb.de>
On Tue, 23 Jun 2009, Arnd Bergmann wrote:
> @@ -71,7 +75,7 @@ static unsigned int do_csum(const unsigned char *buff, int len)
> if (count) {
> unsigned long carry = 0;
> do {
> - unsigned long w = *(unsigned long *) buff;
> + unsigned long w = *(unsigned int *) buff;
> count--;
> buff += 4;
> result += carry;
I don't think this is sufficient.
You might need to make 'result', 'carry', and 'w' be 'unsigned int' too.
Why? Because the final folding is only doen from 32-bit to 16 bit, we
don't do the whole 64-bit to 32-bit to 16-bit chain.
Now, it's possible (even likely) that even with a 64-bit word, we'll never
actually do large enough areas that 'result' would ever have very many
bits set in the 32+ bit region, and since we do end up folding to 16 bits
twice (once after the loop and once at the end), it _probably_ gets things
right in most cases. But I doubt "probably" is strong enough. Somebody
should check.
Or just see arch/alpha/lib/checksum.c, which does the whole 64-bit case.
Maybe lib/checksum.c should be lib/checksum_{32,64}.c.
Linus
next prev parent reply other threads:[~2009-06-23 18:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 15:20 [GIT PULL] asm-generic fixes Arnd Bergmann
2009-06-23 18:33 ` Linus Torvalds [this message]
2009-06-23 19:56 ` Arnd Bergmann
2009-06-23 19:56 ` 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=alpine.LFD.2.01.0906231126460.3240@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--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