From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luca Boccassi Subject: Re: [PATCH] hash: document rte_jhash() boundary behavior Date: Tue, 19 Sep 2017 11:07:55 +0100 Message-ID: <1505815675.19272.19.camel@debian.org> References: <20170918194740.23057-1-3chas3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com, Chas Williams To: Chas Williams <3chas3@gmail.com>, dev@dpdk.org Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id A4A02F04 for ; Tue, 19 Sep 2017 12:08:00 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id m127so3389785wmm.0 for ; Tue, 19 Sep 2017 03:08:00 -0700 (PDT) In-Reply-To: <20170918194740.23057-1-3chas3@gmail.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 2017-09-18 at 15:47 -0400, Chas Williams wrote: > From: Chas Williams >=20 > 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.=C2=A0=C2=A0This may cross a page > boundary. >=20 > Signed-off-by: Chas Williams > --- > =C2=A0lib/librte_hash/rte_jhash.h | 5 ++++- > =C2=A01 file changed, 4 insertions(+), 1 deletion(-) >=20 > 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 > =C2=A0/** > =C2=A0 * The most generic version, hashes an arbitrary sequence > =C2=A0 * of bytes.=C2=A0=C2=A0No alignment or length assumptions are made= about > - * the input key. > + * the input key.=C2=A0=C2=A0For keys not aligned to four byte boundarie= s > + * 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. > =C2=A0 * > =C2=A0 * @param key > =C2=A0 *=C2=A0=C2=A0=C2=A0Key to calculate hash of. Acked-by: Luca Boccassi --=20 Kind regards, Luca Boccassi