DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chas Williams <3chas3@gmail.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com,
	Chas Williams <chas3@att.com>
Subject: [dpdk-dev] [PATCH] hash: document rte_jhash() boundary behavior
Date: Mon, 18 Sep 2017 15:47:40 -0400	[thread overview]
Message-ID: <20170918194740.23057-1-3chas3@gmail.com> (raw)

From: Chas Williams <chas3@att.com>

Due to the uint32_t accesses in the hash computation, keys that aren't
aligned to a uint32_t boundary or multiples of uint32_t in length, may
see accesses beyond the end of the key.  This may cross a page boundary.

Signed-off-by: Chas Williams <chas3@att.com>
---
 lib/librte_hash/rte_jhash.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h
index 207478c..3eca138 100644
--- a/lib/librte_hash/rte_jhash.h
+++ b/lib/librte_hash/rte_jhash.h
@@ -290,7 +290,10 @@ rte_jhash_32b_2hashes(const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t
 /**
  * The most generic version, hashes an arbitrary sequence
  * of bytes.  No alignment or length assumptions are made about
- * the input key.
+ * the input key.  For keys not aligned to four byte boundaries
+ * or a multiple of four bytes in length, the memory region
+ * just after may be read (but not used in the computation).
+ * This may cross a page boundary.
  *
  * @param key
  *   Key to calculate hash of.
-- 
2.9.5

             reply	other threads:[~2017-09-18 19:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 19:47 Chas Williams [this message]
2017-09-19 10:07 ` Luca Boccassi
2017-09-19 13:33 ` Mcnamara, John
2017-10-05 21:37   ` Thomas Monjalon

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=20170918194740.23057-1-3chas3@gmail.com \
    --to=3chas3@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=chas3@att.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).