[Top] [All Lists]

Re: MIPS checksum bug

To: Atsushi Nemoto <>
Subject: Re: MIPS checksum bug
From: "Maciej W. Rozycki" <>
Date: Wed, 17 Sep 2008 15:46:56 +0100 (BST)
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <> <>
On Wed, 17 Sep 2008, Atsushi Nemoto wrote:

> On Wed, 17 Sep 2008 11:40:01 +0100 (BST), "Maciej W. Rozycki" 
> <> wrote:
> > > and it seems to fix the problem for me.  Can you comment?
> > 
> >  It seems obvious that a carry from the bit #15 in the last addition of
> > the passed checksum -- ADDC(sum, a2) -- will negate the effect of the
> > folding.  However a simpler fix should do as well.  Try if the following
> > patch works for you.  Please note this is completely untested and further
> > optimisation is possible, but I've skipped it in this version for clarity.
> Well, csum_partial()'s return value is __wsum (32-bit).  So strictly
> there is no need to folding into 16-bit.

 Hmm, what's the purpose of doing the fold in csum_partial() then?

 Anyway, having looked at the code again the byte swap at the end means
the passed checksum should be added afterwards, so my proposal is
incorrect.  Your suggestion to use 32-bit addition in all cases is 
certainly valid.


<Prev in Thread] Current Thread [Next in Thread>