From: Paul Mackerras <hidden> Date: 2017-03-03 03:50:42
On Sat, Feb 04, 2017 at 05:03:40PM +0800, Shile Zhang wrote:
fix the missed point in Paul's patch:
"powerpc/64: Fix checksum folding in csum_tcpudp_nofold and
ip_fast_csum_nofold"
Signed-off-by: Shile Zhang <redacted>
From: Michael Ellerman <hidden> Date: 2017-03-08 07:25:47
On Sat, 2017-02-04 at 09:03:40 UTC, Shile Zhang wrote:
fix the missed point in Paul's patch:
"powerpc/64: Fix checksum folding in csum_tcpudp_nofold and
ip_fast_csum_nofold"
Signed-off-by: Shile Zhang <redacted>
Acked-by: Paul Mackerras <redacted>
Did you encounter a bug due to that ?
As far as i understand, csum and addend are 32 bits so can't exceed 0xfffff=
fff
Then their sum won't exceed 0x1fffffffe. So the sum of upper and lower=20=
=20
part=20won't carry
Christophe
Did you encounter a bug due to that ?
As far as i understand, csum and addend are 32 bits so can't exceed 0xffffffff
Then their sum won't exceed 0x1fffffffe. So the sum of upper and lower part
won't carry
If the sum of the two halves was 0x1fffffffe, then that previously got
truncated to 32 bits and returned as 0xfffffffe, which is wrong - the
result should be 0xffffffff.
Paul.
Did you encounter a bug due to that ?
As far as i understand, csum and addend are 32 bits so can't exceed=20=
=20
quoted
=200xffffffff
Then their sum won't exceed 0x1fffffffe. So the sum of upper and lower p=
art
quoted
won't carry
If the sum of the two halves was 0x1fffffffe, then that previously got
truncated to 32 bits and returned as 0xfffffffe, which is wrong - the
result should be 0xffffffff.
It is the sum of the two arguments of csum_add() which can't exceed=20=20
0x1fffffffe
So=20the sum of the two halves will be 0xffffffff which is the expected res=
ult.
The issue would start with res =3D 0x1ffffffff, in that case the sum of=20=
=20
the=20two halves would be 0x100000000 which would have been truncated to=20=
=20
0=20whereas we expect the result to be 1 in that case.
But in order to obtain res =3D 0x1ffffffff or higher, you have to sum at=20=
=20
least=20three 32 bits numbers. You can't obtain such a value with a sum=20=
=20
of=20two 32 bits numbers.
Christophe