aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/lib/ip_fast_csum.S
diff options
context:
space:
mode:
authorChen, Kenneth W <kenneth.w.chen@intel.com>2006-11-08 19:29:25 -0500
committerTony Luck <tony.luck@intel.com>2006-12-07 14:19:59 -0500
commit6dbfc19b7ea93f94f1efabaae71a921b49d8cae2 (patch)
treeecf26fe7da3e261e81a878942604aca3c9fe7e2d /arch/ia64/lib/ip_fast_csum.S
parent007d77d0c5eb36555443ff273ce2a27f90da8837 (diff)
[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 <kenneth.w.chen@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/lib/ip_fast_csum.S')
-rw-r--r--arch/ia64/lib/ip_fast_csum.S3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/ia64/lib/ip_fast_csum.S b/arch/ia64/lib/ip_fast_csum.S
index 4fb132ee207a..1f86aeb2c948 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)
68 zxt2 r20=r20 68 zxt2 r20=r20
69 ;; 69 ;;
70 add r20=ret0,r20 70 add r20=ret0,r20
71 mov r9=0xffff
71 ;; 72 ;;
72 andcm ret0=-1,r20 73 andcm ret0=r9,r20
73 .restore sp // reset frame state 74 .restore sp // reset frame state
74 br.ret.sptk.many b0 75 br.ret.sptk.many b0
75 ;; 76 ;;