patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 20.11 1/4] net/ena: remove useless address check
@ 2022-12-08 14:49 David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 2/4] net/ena: fix build with GCC 12 David Marchand
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Marchand @ 2022-12-08 14:49 UTC (permalink / raw)
  To: stable; +Cc: bluca, Ferruh Yigit, Michal Krawczyk

From: Ferruh Yigit <ferruh.yigit@intel.com>

[ upstream commit 7a4edfd7bbcd0a3bcb726bc8a109419a600273be ]

Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":

./drivers/net/ena/ena_rss.c: In function ‘ena_rss_reta_query’:
./drivers/net/ena/ena_rss.c:140:66:
	error: the comparison will always evaluate as ‘false’ for the
	pointer operand in ‘reta_conf + 136’ must not be NULL
	[-Werror=address]
  140 |  (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
      |                                                       ^~

Fixing it by removing useless check.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Note on backport:
- moved change to ena_ethdev.c,

---
 drivers/net/ena/ena_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 64e38e49fa..a4aac5a892 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -643,8 +643,7 @@ static int ena_rss_reta_query(struct rte_eth_dev *dev,
 	int reta_conf_idx;
 	int reta_idx;
 
-	if (reta_size == 0 || reta_conf == NULL ||
-	    (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
+	if (reta_size == 0 || reta_conf == NULL)
 		return -EINVAL;
 
 	rte_spinlock_lock(&adapter->admin_lock);
-- 
2.38.1


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

* [PATCH 20.11 2/4] net/ena: fix build with GCC 12
  2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
@ 2022-12-08 14:49 ` David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 3/4] net/qede: fix minsize build David Marchand
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2022-12-08 14:49 UTC (permalink / raw)
  To: stable; +Cc: bluca, Stephen Hemminger

[ upstream commit 2449949584667fbb275df1ea5a5ceeead1a65786 ]

GCC 12 raises the following warning:

In file included from ../lib/mempool/rte_mempool.h:46,
                 from ../lib/mbuf/rte_mbuf.h:38,
                 from ../lib/net/rte_ether.h:22,
                 from ../drivers/net/ena/ena_ethdev.h:10,
                 from ../drivers/net/ena/ena_rss.c:6:
../drivers/net/ena/ena_rss.c: In function ‘ena_rss_key_fill’:
../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is
        outside array bounds of ‘uint8_t[40]’
        {aka ‘unsigned char[40]’} [-Warray-bounds]
  370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ena/ena_rss.c:51:24: note: while referencing ‘default_key’
   51 | static uint8_t default_key[ENA_HASH_KEY_SIZE];
      |                ^~~~~~~~~~~

This is a false positive because the copied size is checked against
ENA_HASH_KEY_SIZE in a (build) assert.
Silence this warning by calling memcpy with the minimal size.

Bugzilla ID: 849

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
Note on backport:
- moved change to ena_ethdev.c,

---
 drivers/net/ena/ena_ethdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index a4aac5a892..aa2b52ed47 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -292,15 +292,14 @@ void ena_rss_key_fill(void *key, size_t size)
 	static uint8_t default_key[ENA_HASH_KEY_SIZE];
 	size_t i;
 
-	RTE_ASSERT(size <= ENA_HASH_KEY_SIZE);
-
 	if (!key_generated) {
-		for (i = 0; i < ENA_HASH_KEY_SIZE; ++i)
+		for (i = 0; i < RTE_DIM(default_key); ++i)
 			default_key[i] = rte_rand() & 0xff;
 		key_generated = true;
 	}
 
-	rte_memcpy(key, default_key, size);
+	RTE_ASSERT(size <= sizeof(default_key));
+	rte_memcpy(key, default_key, RTE_MIN(size, sizeof(default_key)));
 }
 
 static inline void ena_trigger_reset(struct ena_adapter *adapter,
-- 
2.38.1


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

* [PATCH 20.11 3/4] net/qede: fix minsize build
  2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 2/4] net/ena: fix build with GCC 12 David Marchand
@ 2022-12-08 14:49 ` David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12 David Marchand
  2022-12-08 16:55 ` [PATCH 20.11 1/4] net/ena: remove useless address check Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2022-12-08 14:49 UTC (permalink / raw)
  To: stable; +Cc: bluca, Thomas Monjalon, Devendra Singh Rawat, Rasesh Mody

From: Thomas Monjalon <thomas@monjalon.net>

[ upstream commit 11c2e4b41c962414e7183222a6504697493d9433 ]

Error occurs when configuring meson with --buildtype=minsize
with GCC 11.1.0:

In function ‘__internal_ram_wr_relaxed’,
    inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2,
    inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
drivers/net/qede/base/bcm_osal.h:136:9: error:
‘rx_prods’ is used uninitialized [-Werror=uninitialized]
|         rte_write32_relaxed((_val), (_reg_addr))
|         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ecore_int_api.h:151:17: note: in expansion of macro ‘DIRECT_REG_WR_RELAXED’
|                 DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i],
|                 ^~~~~~~~~~~~~~~~~~~~~
drivers/net/qede/qede_rxtx.c: In function ‘qede_update_rx_prod.constprop’:
drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
|         struct eth_rx_prod_data rx_prods = { 0 };
|                                 ^~~~~~~~

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Devendra Singh Rawat <dsinghrawat@marvell.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
---
 drivers/net/qede/qede_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index f357a8f258..65acad2789 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -714,9 +714,10 @@ qede_update_rx_prod(__rte_unused struct qede_dev *edev,
 {
 	uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
 	uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq->rx_comp_ring);
-	struct eth_rx_prod_data rx_prods = { 0 };
+	struct eth_rx_prod_data rx_prods;
 
 	/* Update producers */
+	memset(&rx_prods, 0, sizeof(rx_prods));
 	rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
 	rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
 
-- 
2.38.1


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

* [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12
  2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 2/4] net/ena: fix build with GCC 12 David Marchand
  2022-12-08 14:49 ` [PATCH 20.11 3/4] net/qede: fix minsize build David Marchand
@ 2022-12-08 14:49 ` David Marchand
  2022-12-08 16:55 ` [PATCH 20.11 1/4] net/ena: remove useless address check Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2022-12-08 14:49 UTC (permalink / raw)
  To: stable; +Cc: bluca, Stephen Hemminger

[ upstream commit 468f31eb71c4c2aa454841b316766514cabd0f02 ]

GCC 12 raises the following warning:

In function ‘__rte_ring_enqueue_elems_64’,
    inlined from ‘__rte_ring_enqueue_elems’ at
        ../lib/ring/rte_ring_elem_pvt.h:130:3,
    inlined from ‘__rte_ring_do_hts_enqueue_elem’ at
        ../lib/ring/rte_ring_hts_elem_pvt.h:196:3,
    inlined from ‘rte_ring_mp_hts_enqueue_burst_elem’ at
        ../lib/ring/rte_ring_hts.h:110:9,
    inlined from ‘rte_ring_enqueue_burst_elem’ at
        ../lib/ring/rte_ring_elem.h:577:10,
    inlined from ‘rte_ring_enqueue_burst’ at
        ../lib/ring/rte_ring.h:738:9,
    inlined from ‘process_op_bit’ at
        ../drivers/crypto/ipsec_mb/pmd_snow3g.c:425:16,
    inlined from ‘snow3g_pmd_dequeue_burst’ at
        ../drivers/crypto/ipsec_mb/pmd_snow3g.c:484:20:
../lib/ring/rte_ring_elem_pvt.h:68:44: error: array subscript 1 is
        outside array bounds of ‘struct rte_crypto_op[0]’
        [-Werror=array-bounds]
   68 |                         ring[idx + 1] = obj[i + 1];
      |                                         ~~~^~~~~~~
../drivers/crypto/ipsec_mb/pmd_snow3g.c: In function
        ‘snow3g_pmd_dequeue_burst’:
../drivers/crypto/ipsec_mb/pmd_snow3g.c:434:1: note:
        at offset 8 into object ‘op’ of size 8
  434 | snow3g_pmd_dequeue_burst(void *queue_pair,
      | ^~~~~~~~~~~~~~~~~~~~~~~~

Validate that one (exactly) op has been processed or return early.

Fixes: b537abdbee74 ("crypto/snow3g: support bit-level operations")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
Note on backport:
- applied change to kasumi and snow3g drivers,

---
 drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 ++++---
 drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 5ff1b5c562..cbf832f861 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -385,12 +385,13 @@ process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
 		op->sym->session = NULL;
 	}
 
-	enqueued_op = rte_ring_enqueue_burst(qp->processed_ops, (void **)&op,
-				processed_op, NULL);
+	if (unlikely(processed_op != 1))
+		return 0;
+	enqueued_op = rte_ring_enqueue(qp->processed_ops, op);
 	qp->qp_stats.enqueued_count += enqueued_op;
 	*accumulated_enqueued_ops += enqueued_op;
 
-	return enqueued_op;
+	return 1;
 }
 
 static uint16_t
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 962868e1fc..2e2c8412ae 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -410,12 +410,13 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
 		op->sym->session = NULL;
 	}
 
-	enqueued_op = rte_ring_enqueue_burst(qp->processed_ops,
-			(void **)&op, processed_op, NULL);
+	if (unlikely(processed_op != 1))
+		return 0;
+	enqueued_op = rte_ring_enqueue(qp->processed_ops, op);
 	qp->qp_stats.enqueued_count += enqueued_op;
 	*accumulated_enqueued_ops += enqueued_op;
 
-	return enqueued_op;
+	return 1;
 }
 
 static uint16_t
-- 
2.38.1


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

* Re: [PATCH 20.11 1/4] net/ena: remove useless address check
  2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
                   ` (2 preceding siblings ...)
  2022-12-08 14:49 ` [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12 David Marchand
@ 2022-12-08 16:55 ` Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: Luca Boccassi @ 2022-12-08 16:55 UTC (permalink / raw)
  To: David Marchand, stable; +Cc: Ferruh Yigit, Michal Krawczyk

On Thu, 2022-12-08 at 15:49 +0100, David Marchand wrote:
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> [ upstream commit 7a4edfd7bbcd0a3bcb726bc8a109419a600273be ]
> 
> Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":
> 
> ./drivers/net/ena/ena_rss.c: In function ‘ena_rss_reta_query’:
> ./drivers/net/ena/ena_rss.c:140:66:
> 	error: the comparison will always evaluate as ‘false’ for the
> 	pointer operand in ‘reta_conf + 136’ must not be NULL
> 	[-Werror=address]
>   140 |  (reta_size > RTE_RETA_GROUP_SIZE && ((reta_conf + 1) == NULL)))
>       |                                                       ^~
> 
> Fixing it by removing useless check.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Acked-by: Michal Krawczyk <mk@semihalf.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> Note on backport:
> - moved change to ena_ethdev.c,
> 
> ---
>  drivers/net/ena/ena_ethdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Thanks, all applied and pushed.

-- 
Kind regards,
Luca Boccassi

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

end of thread, other threads:[~2022-12-08 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 14:49 [PATCH 20.11 1/4] net/ena: remove useless address check David Marchand
2022-12-08 14:49 ` [PATCH 20.11 2/4] net/ena: fix build with GCC 12 David Marchand
2022-12-08 14:49 ` [PATCH 20.11 3/4] net/qede: fix minsize build David Marchand
2022-12-08 14:49 ` [PATCH 20.11 4/4] crypto/ipsec_mb: fix build with GCC 12 David Marchand
2022-12-08 16:55 ` [PATCH 20.11 1/4] net/ena: remove useless address check Luca Boccassi

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