DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] test/efd: fix size of constant
@ 2022-02-24 15:48 Pablo de Lara
  2022-02-24 15:48 ` [PATCH 2/2] efd: fix uninitialized structure Pablo de Lara
  2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
  0 siblings, 2 replies; 9+ messages in thread
From: Pablo de Lara @ 2022-02-24 15:48 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Constant value 1 has a size of 32 bits, and shifting it more than 32 bits
to the left overflows. 1ULL is needed to be able to get a 64-bit value.

Coverity ID: 375846
Fixes: 8751a7e9832b ("efd: allow more CPU sockets in table creation")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 7bea674086..fa29e8f97a 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -107,7 +107,7 @@ static inline uint64_t efd_get_all_sockets_bitmask(void)
 	unsigned int next_lcore = rte_get_main_lcore();
 	const int val_true = 1, val_false = 0;
 	for (i = 0; i < rte_lcore_count(); i++) {
-		all_cpu_sockets_bitmask |= 1 << rte_lcore_to_socket_id(next_lcore);
+		all_cpu_sockets_bitmask |= 1ULL << rte_lcore_to_socket_id(next_lcore);
 		next_lcore = rte_get_next_lcore(next_lcore, val_false, val_true);
 	}
 
-- 
2.25.1


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

* [PATCH 2/2] efd: fix uninitialized structure
  2022-02-24 15:48 [PATCH 1/2] test/efd: fix size of constant Pablo de Lara
@ 2022-02-24 15:48 ` Pablo de Lara
  2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
  1 sibling, 0 replies; 9+ messages in thread
From: Pablo de Lara @ 2022-02-24 15:48 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Coverity flags that both elements of efd_online_group_entry
are used unititialized. This is OK because this structure
is initially used for starting values, so any value is OK.

Coverity ID: 375868
Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/efd/rte_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 560cd78961..86910e587c 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -1162,7 +1162,7 @@ rte_efd_update(struct rte_efd_table * const table, const unsigned int socket_id,
 {
 	uint32_t chunk_id = 0, group_id = 0, bin_id = 0;
 	uint8_t new_bin_choice = 0;
-	struct efd_online_group_entry entry;
+	struct efd_online_group_entry entry = {0};
 
 	int status = efd_compute_update(table, socket_id, key, value,
 			&chunk_id, &group_id, &bin_id,
-- 
2.25.1


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

* [PATCH v2 1/2] test/efd: fix size of constant
  2022-02-24 15:48 [PATCH 1/2] test/efd: fix size of constant Pablo de Lara
  2022-02-24 15:48 ` [PATCH 2/2] efd: fix uninitialized structure Pablo de Lara
@ 2022-02-24 15:57 ` Pablo de Lara
  2022-02-24 15:57   ` [PATCH v2 2/2] efd: fix uninitialized structure Pablo de Lara
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Pablo de Lara @ 2022-02-24 15:57 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Constant value 1 has a size of 32 bits, and shifting it more than 32 bits
to the left overflows. 1ULL is needed to be able to get a 64-bit value.

Coverity ID: 375846
Fixes: 8751a7e9832b ("efd: allow more CPU sockets in table creation")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 7bea674086..fa29e8f97a 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -107,7 +107,7 @@ static inline uint64_t efd_get_all_sockets_bitmask(void)
 	unsigned int next_lcore = rte_get_main_lcore();
 	const int val_true = 1, val_false = 0;
 	for (i = 0; i < rte_lcore_count(); i++) {
-		all_cpu_sockets_bitmask |= 1 << rte_lcore_to_socket_id(next_lcore);
+		all_cpu_sockets_bitmask |= 1ULL << rte_lcore_to_socket_id(next_lcore);
 		next_lcore = rte_get_next_lcore(next_lcore, val_false, val_true);
 	}
 
-- 
2.25.1


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

* [PATCH v2 2/2] efd: fix uninitialized structure
  2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
@ 2022-02-24 15:57   ` Pablo de Lara
  2022-02-24 17:14     ` Wang, Yipeng1
  2022-02-24 17:15   ` [PATCH v2 1/2] test/efd: fix size of constant Wang, Yipeng1
  2022-02-25  9:27   ` [PATCH v3 " Pablo de Lara
  2 siblings, 1 reply; 9+ messages in thread
From: Pablo de Lara @ 2022-02-24 15:57 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Coverity flags that both elements of efd_online_group_entry
are used uninitialized. This is OK because this structure
is initially used for starting values, so any value is OK.

Coverity ID: 375868
Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---

-v2: Fixed typo in commit message 

---
 lib/efd/rte_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 560cd78961..86910e587c 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -1162,7 +1162,7 @@ rte_efd_update(struct rte_efd_table * const table, const unsigned int socket_id,
 {
 	uint32_t chunk_id = 0, group_id = 0, bin_id = 0;
 	uint8_t new_bin_choice = 0;
-	struct efd_online_group_entry entry;
+	struct efd_online_group_entry entry = {0};
 
 	int status = efd_compute_update(table, socket_id, key, value,
 			&chunk_id, &group_id, &bin_id,
-- 
2.25.1


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

* RE: [PATCH v2 2/2] efd: fix uninitialized structure
  2022-02-24 15:57   ` [PATCH v2 2/2] efd: fix uninitialized structure Pablo de Lara
@ 2022-02-24 17:14     ` Wang, Yipeng1
  0 siblings, 0 replies; 9+ messages in thread
From: Wang, Yipeng1 @ 2022-02-24 17:14 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Marohn, Byron; +Cc: dev, stable

> -----Original Message-----
> From: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Sent: Thursday, February 24, 2022 7:58 AM
> To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Marohn, Byron
> <byron.marohn@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2 2/2] efd: fix uninitialized structure
> 
> Coverity flags that both elements of efd_online_group_entry are used
> uninitialized. This is OK because this structure is initially used for starting
> values, so any value is OK.
> 
> Coverity ID: 375868
> Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
> 
> -v2: Fixed typo in commit message
> 
> ---
>  lib/efd/rte_efd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c index
> 560cd78961..86910e587c 100644
> --- a/lib/efd/rte_efd.c
> +++ b/lib/efd/rte_efd.c
> @@ -1162,7 +1162,7 @@ rte_efd_update(struct rte_efd_table * const table,
> const unsigned int socket_id,  {
>  	uint32_t chunk_id = 0, group_id = 0, bin_id = 0;
>  	uint8_t new_bin_choice = 0;
> -	struct efd_online_group_entry entry;
> +	struct efd_online_group_entry entry = {0};
> 
>  	int status = efd_compute_update(table, socket_id, key, value,
>  			&chunk_id, &group_id, &bin_id,
> --
> 2.25.1
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>


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

* RE: [PATCH v2 1/2] test/efd: fix size of constant
  2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
  2022-02-24 15:57   ` [PATCH v2 2/2] efd: fix uninitialized structure Pablo de Lara
@ 2022-02-24 17:15   ` Wang, Yipeng1
  2022-02-25  9:27   ` [PATCH v3 " Pablo de Lara
  2 siblings, 0 replies; 9+ messages in thread
From: Wang, Yipeng1 @ 2022-02-24 17:15 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Marohn, Byron; +Cc: dev, stable

> -----Original Message-----
> From: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Sent: Thursday, February 24, 2022 7:58 AM
> To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Marohn, Byron
> <byron.marohn@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2 1/2] test/efd: fix size of constant
> 
> Constant value 1 has a size of 32 bits, and shifting it more than 32 bits to the
> left overflows. 1ULL is needed to be able to get a 64-bit value.
> 
> Coverity ID: 375846
> Fixes: 8751a7e9832b ("efd: allow more CPU sockets in table creation")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  app/test/test_efd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_efd.c b/app/test/test_efd.c index
> 7bea674086..fa29e8f97a 100644
> --- a/app/test/test_efd.c
> +++ b/app/test/test_efd.c
> @@ -107,7 +107,7 @@ static inline uint64_t
> efd_get_all_sockets_bitmask(void)
>  	unsigned int next_lcore = rte_get_main_lcore();
>  	const int val_true = 1, val_false = 0;
>  	for (i = 0; i < rte_lcore_count(); i++) {
> -		all_cpu_sockets_bitmask |= 1 <<
> rte_lcore_to_socket_id(next_lcore);
> +		all_cpu_sockets_bitmask |= 1ULL <<
> +rte_lcore_to_socket_id(next_lcore);
>  		next_lcore = rte_get_next_lcore(next_lcore, val_false,
> val_true);
>  	}
> 
> --
> 2.25.1
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>


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

* [PATCH v3 1/2] test/efd: fix size of constant
  2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
  2022-02-24 15:57   ` [PATCH v2 2/2] efd: fix uninitialized structure Pablo de Lara
  2022-02-24 17:15   ` [PATCH v2 1/2] test/efd: fix size of constant Wang, Yipeng1
@ 2022-02-25  9:27   ` Pablo de Lara
  2022-02-25  9:27     ` [PATCH v3 2/2] efd: fix uninitialized structure Pablo de Lara
  2 siblings, 1 reply; 9+ messages in thread
From: Pablo de Lara @ 2022-02-25  9:27 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Constant value 1 has a size of 32 bits, and shifting it more than 32 bits
to the left overflows. 1ULL is needed to be able to get a 64-bit value.

Coverity ID: 375846
Fixes: 8751a7e9832b ("efd: allow more CPU sockets in table creation")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
---
 app/test/test_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_efd.c b/app/test/test_efd.c
index 7bea674086..fa29e8f97a 100644
--- a/app/test/test_efd.c
+++ b/app/test/test_efd.c
@@ -107,7 +107,7 @@ static inline uint64_t efd_get_all_sockets_bitmask(void)
 	unsigned int next_lcore = rte_get_main_lcore();
 	const int val_true = 1, val_false = 0;
 	for (i = 0; i < rte_lcore_count(); i++) {
-		all_cpu_sockets_bitmask |= 1 << rte_lcore_to_socket_id(next_lcore);
+		all_cpu_sockets_bitmask |= 1ULL << rte_lcore_to_socket_id(next_lcore);
 		next_lcore = rte_get_next_lcore(next_lcore, val_false, val_true);
 	}
 
-- 
2.25.1


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

* [PATCH v3 2/2] efd: fix uninitialized structure
  2022-02-25  9:27   ` [PATCH v3 " Pablo de Lara
@ 2022-02-25  9:27     ` Pablo de Lara
  2022-02-27 17:59       ` Thomas Monjalon
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo de Lara @ 2022-02-25  9:27 UTC (permalink / raw)
  To: yipeng1.wang, byron.marohn; +Cc: dev, Pablo de Lara, stable

Coverity flags that both elements of efd_online_group_entry
are used uninitialized. This is OK because this structure
is initially used for starting values, so any value is OK.

Coverity ID: 375868
Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
---

-v3: Fixed RHEL build
-v2: Fixed typo in commit message 

---
 lib/efd/rte_efd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 560cd78961..bbc6fc585d 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -1162,7 +1162,7 @@ rte_efd_update(struct rte_efd_table * const table, const unsigned int socket_id,
 {
 	uint32_t chunk_id = 0, group_id = 0, bin_id = 0;
 	uint8_t new_bin_choice = 0;
-	struct efd_online_group_entry entry;
+	struct efd_online_group_entry entry = {{0}};
 
 	int status = efd_compute_update(table, socket_id, key, value,
 			&chunk_id, &group_id, &bin_id,
-- 
2.25.1


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

* Re: [PATCH v3 2/2] efd: fix uninitialized structure
  2022-02-25  9:27     ` [PATCH v3 2/2] efd: fix uninitialized structure Pablo de Lara
@ 2022-02-27 17:59       ` Thomas Monjalon
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2022-02-27 17:59 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: yipeng1.wang, byron.marohn, stable, dev

25/02/2022 10:27, Pablo de Lara:
> Coverity flags that both elements of efd_online_group_entry
> are used uninitialized. This is OK because this structure
> is initially used for starting values, so any value is OK.
> 
> Coverity ID: 375868
> Fixes: 56b6ef874f80 ("efd: new Elastic Flow Distributor library")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>

Series applied, thanks.




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

end of thread, other threads:[~2022-02-27 17:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 15:48 [PATCH 1/2] test/efd: fix size of constant Pablo de Lara
2022-02-24 15:48 ` [PATCH 2/2] efd: fix uninitialized structure Pablo de Lara
2022-02-24 15:57 ` [PATCH v2 1/2] test/efd: fix size of constant Pablo de Lara
2022-02-24 15:57   ` [PATCH v2 2/2] efd: fix uninitialized structure Pablo de Lara
2022-02-24 17:14     ` Wang, Yipeng1
2022-02-24 17:15   ` [PATCH v2 1/2] test/efd: fix size of constant Wang, Yipeng1
2022-02-25  9:27   ` [PATCH v3 " Pablo de Lara
2022-02-25  9:27     ` [PATCH v3 2/2] efd: fix uninitialized structure Pablo de Lara
2022-02-27 17:59       ` 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).