Skip to content

Commit

Permalink
The type of sum in csum_tcpudp_nofold is "unsigned int", so when we a…
Browse files Browse the repository at this point in the history
…ssign

to it in an asm() block, and we're running on a system with 64-bit
registers, it is vitally important that we sign extend it correctly before
returning to C.  Otherwise the stray high bits will be preserved into
csum_fold, and on the SB-1 processor, 32-bit arithmetic on a non
sign-extended register will yield surprising results.
    
This caused incorrect checksums in some UDP packets for NFS root.  The
problem was mild when using a 10.0.1.x IP address, but severe when
using 192.168.1.x.
    
Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Oct 29, 2005
1 parent 2cce826 commit e972883
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/asm-mips/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
" daddu %0, %4 \n"
" dsll32 $1, %0, 0 \n"
" daddu %0, $1 \n"
" dsrl32 %0, %0, 0 \n"
" dsra32 %0, %0, 0 \n"
#endif
" .set pop"
: "=r" (sum)
Expand Down

0 comments on commit e972883

Please sign in to comment.