From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [patch] tidy up return value of ip_fast_csum
Date: Thu, 09 Nov 2006 00:29:25 +0000 [thread overview]
Message-ID: <000101c70396$1ce44c50$ff0da8c0@amr.corp.intel.com> (raw)
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>
--- ./arch/ia64/lib/ip_fast_csum.S.orig 2006-11-08 17:09:36.000000000 -0800
+++ ./arch/ia64/lib/ip_fast_csum.S 2006-11-08 17:10:04.000000000 -0800
@@ -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
;;
reply other threads:[~2006-11-09 0:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000101c70396$1ce44c50$ff0da8c0@amr.corp.intel.com' \
--to=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox