From: Chen, Kenneth W Date: Thu, 9 Nov 2006 00:29:25 +0000 (-0800) Subject: [IA64] tidy up return value of ip_fast_csum X-Git-Tag: v2.6.20-rc1~15^2~2^2~8^2~5 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=6dbfc19b7ea93f94f1efabaae71a921b49d8cae2;p=safe%2Fjmp%2Flinux-2.6 [IA64] tidy up return value of ip_fast_csum While working on implementing csum_ipv6_magic, I noticed that current version of ip_fast_csum will potentially return bits above "unsigned short" as 1. While no harm is done right now because all call sites will chop off the upper bits when it uses the return value. However, this is still dangerous and buggy. Here is a patch to enforce that the function really returns unsigned short in the native register format. The fix is free as there are plenty open slot to add one more asm instruction. Signed-off-by: Ken Chen Signed-off-by: Tony Luck --- diff --git a/arch/ia64/lib/ip_fast_csum.S b/arch/ia64/lib/ip_fast_csum.S index 4fb132e..1f86aeb 100644 --- a/arch/ia64/lib/ip_fast_csum.S +++ b/arch/ia64/lib/ip_fast_csum.S @@ -68,8 +68,9 @@ GLOBAL_ENTRY(ip_fast_csum) zxt2 r20=r20 ;; add r20=ret0,r20 + mov r9=0xffff ;; - andcm ret0=-1,r20 + andcm ret0=r9,r20 .restore sp // reset frame state br.ret.sptk.many b0 ;;