DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH]  lib/librte_ip_frag:fix ip_frag_key_cmp bug
@ 2018-08-02  2:01 Li Han
  2018-08-05 12:59 ` Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Li Han @ 2018-08-02  2:01 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: dev, Li Han

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 <han.li1@zte.com.cn>
---
 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH]  lib/librte_ip_frag:fix ip_frag_key_cmp bug
  2018-08-02  2:01 [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug Li Han
@ 2018-08-05 12:59 ` Thomas Monjalon
  2018-08-09 12:40 ` Ferruh Yigit
  2018-08-24 11:04 ` Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-08-05 12:59 UTC (permalink / raw)
  To: konstantin.ananyev; +Cc: dev, Li Han

Konstantin,
Is it candidate for last minute fix in 18.08?


02/08/2018 04:01, Li Han:
> 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 <han.li1@zte.com.cn>
> ---
>  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];
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug
  2018-08-02  2:01 [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug Li Han
  2018-08-05 12:59 ` Thomas Monjalon
@ 2018-08-09 12:40 ` Ferruh Yigit
  2018-08-24 11:04 ` Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-08-09 12:40 UTC (permalink / raw)
  To: Li Han, konstantin.ananyev; +Cc: dev

On 8/2/2018 3:01 AM, Li Han wrote:
> 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 <han.li1@zte.com.cn>

Fix looks good to me [1], but not sure if it worth getting risk to merge it
after rc3, taking into account that original code is from 2014.

[1] perhaps no need to make "i" uint64_t

> ---
>  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];
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH]  lib/librte_ip_frag:fix ip_frag_key_cmp bug
  2018-08-02  2:01 [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug Li Han
  2018-08-05 12:59 ` Thomas Monjalon
  2018-08-09 12:40 ` Ferruh Yigit
@ 2018-08-24 11:04 ` Ananyev, Konstantin
  2018-10-28 10:18   ` Thomas Monjalon
  2 siblings, 1 reply; 5+ messages in thread
From: Ananyev, Konstantin @ 2018-08-24 11:04 UTC (permalink / raw)
  To: Li Han; +Cc: dev



> -----Original Message-----
> From: Li Han [mailto:han.li1@zte.com.cn]
> Sent: Thursday, August 2, 2018 3:01 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; Li Han <han.li1@zte.com.cn>
> Subject: [PATCH] [dpdk-dev] lib/librte_ip_frag:fix ip_frag_key_cmp bug
> 
> 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 <han.li1@zte.com.cn>
> ---
>  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];
> --

As a nit - no point to make *i* 64-bit.
Apart from that:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH]  lib/librte_ip_frag:fix ip_frag_key_cmp bug
  2018-08-24 11:04 ` Ananyev, Konstantin
@ 2018-10-28 10:18   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-10-28 10:18 UTC (permalink / raw)
  To: Ananyev, Konstantin, Li Han; +Cc: dev

24/08/2018 13:04, Ananyev, Konstantin:
> From: Li Han [mailto:han.li1@zte.com.cn]
> > 
> > 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 <han.li1@zte.com.cn>
> > ---
> >  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];
> > --
> 
> As a nit - no point to make *i* 64-bit.
> Apart from that:
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied with suggested change, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-28 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02  2:01 [dpdk-dev] [PATCH] lib/librte_ip_frag:fix ip_frag_key_cmp bug Li Han
2018-08-05 12:59 ` Thomas Monjalon
2018-08-09 12:40 ` Ferruh Yigit
2018-08-24 11:04 ` Ananyev, Konstantin
2018-10-28 10:18   ` Thomas Monjalon

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).