From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) by dpdk.org (Postfix) with ESMTP id 7E3881B3AD for ; Thu, 2 Aug 2018 04:33:43 +0200 (CEST) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 53A29DE9D8339F2FB9D9; Thu, 2 Aug 2018 10:33:42 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w722XYwj063830; Thu, 2 Aug 2018 10:33:34 +0800 (GMT-8) (envelope-from han.li1@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.165]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018080210333998-2934566 ; Thu, 2 Aug 2018 10:33:39 +0800 From: Li Han To: konstantin.ananyev@intel.com Cc: dev@dpdk.org, Li Han Date: Wed, 1 Aug 2018 22:01:03 -0400 Message-Id: <1533175263-4642-1-git-send-email-han.li1@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-08-02 10:33:40, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-08-02 10:33:22, Serialize complete at 2018-08-02 10:33:22 X-MAIL: mse01.zte.com.cn w722XYwj063830 Subject: [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2018 02:33:43 -0000 in struct ip_frag_key,src_dst[] type is uint64_t. but "val" which to store the calc restult ,type is uint32_t. we may lost high 32 bit key. and function return value is int, but it won't return < 0. Signed-off-by: Li Han --- lib/librte_ip_frag/ip_frag_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_ip_frag/ip_frag_common.h b/lib/librte_ip_frag/ip_frag_common.h index 197acf8..ca69680 100644 --- a/lib/librte_ip_frag/ip_frag_common.h +++ b/lib/librte_ip_frag/ip_frag_common.h @@ -69,10 +69,10 @@ struct ip_frag_pkt * ip_frag_lookup(struct rte_ip_frag_tbl *tbl, } /* compare two keys */ -static inline int +static inline uint64_t ip_frag_key_cmp(const struct ip_frag_key * k1, const struct ip_frag_key * k2) { - uint32_t i, val; + uint64_t i, val; val = k1->id ^ k2->id; for (i = 0; i < k1->key_len; i++) val |= k1->src_dst[i] ^ k2->src_dst[i]; -- 1.8.3.1