Skip to contentSkip to conversation

fix minsize build

PATCH In review Cheryl Bansal 2 participants 14 messages Nov 30

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover fix minsize build

With gcc 13, --buildtype=minsize and -Werror, the build fails with -Wmaybe-uninitialized in the 12 places below. Each variable is set before it is used. gcc does not see that under minsize, so initialize it. Behavior is unchanged.

The same warning in lib/hash was sent separately.

Cheryl Bansal (12):
member: fix minsize build
mempool/bucket: fix minsize build
dma/skeleton: fix minsize build
dma/dpaa: fix minsize build
net/softnic: fix minsize build
net/nfp: fix minsize build
net/pcap: fix minsize build
net/mlx5: fix minsize build
crypto/mlx5: fix minsize build
crypto/ccp: fix minsize build
common/cnxk: fix minsize build
test/bonding: fix minsize build

 app/test/test_link_bonding_mode4.c           | 2 +-
 drivers/common/cnxk/cnxk_security.c          | 2 +-
 drivers/crypto/ccp/ccp_crypto.c              | 2 +-
 drivers/crypto/mlx5/mlx5_crypto_gcm.c        | 2 +-
 drivers/dma/dpaa/dpaa_qdma.c                 | 2 +-
 drivers/dma/skeleton/skeleton_dmadev.c       | 6 +++---
 drivers/mempool/bucket/rte_mempool_bucket.c  | 4 ++--
 drivers/net/mlx5/mlx5_flow_hw.c              | 2 +-
 drivers/net/nfp/nfpcore/nfp_elf.c            | 2 +-
 drivers/net/pcap/pcap_ethdev.c               | 4 ++--
 drivers/net/softnic/rte_eth_softnic_thread.c | 4 ++--
 lib/member/rte_member_heap.h                 | 2 +-
 12 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/12 member: fix minsize build

This error is seen in build of type "minsize":

In function 'rte_member_minheap_insert_node':
lib/member/rte_member_heap.h:264:48: error:
'slot_id' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we return early if rte_ring_sc_dequeue_elem() fails, so slot_id is always set.

The variable is initialized to allow compiling with "minsize" option.

Fixes db354bd2e1f8 ("member: add NitroSketch mode")
---
 lib/member/rte_member_heap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/member/rte_member_heap.h +1 -1
index d551c85a75..4c9fd8bca2 100644
@@ -253,7 +253,7 @@ rte_member_minheap_insert_node(struct minheap *hp, const void *key,
 			       struct rte_ring *free_key_slot)
 {
 	struct node nd;
-	uint32_t slot_id;
+	uint32_t slot_id = 0;
 
 	if (rte_ring_sc_dequeue_elem(free_key_slot, &slot_id, sizeof(uint32_t)) != 0) {
 		MEMBER_LOG(ERR, "Minheap get empty keyslot failed");
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/12 mempool/bucket: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/mempool/bucket/rte_mempool_bucket.c:271:30: error:
'orphan' may be used uninitialized [-Werror=maybe-uninitialized] drivers/mempool/bucket/rte_mempool_bucket.c:171:21: error:
'hdr' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because the values are only used when the ring dequeue succeeded.

The variables are initialized to allow compiling with "minsize" option.

Fixes 4ed00862c81d ("mempool/bucket: implement bucket mempool manager")
---
 drivers/mempool/bucket/rte_mempool_bucket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mempool/bucket/rte_mempool_bucket.c +2 -2
index 6fee10176b..e93a9cefb5 100644
@@ -235,7 +235,7 @@ bucket_dequeue_buckets(struct bucket_data *bd, void **obj_table,
 						  bd->obj_per_bucket);
 	}
 	while (n_buckets-- > 0) {
-		struct bucket_header *hdr;
+		struct bucket_header *hdr = NULL;
 
 		if (unlikely(rte_ring_dequeue(bd->shared_bucket_ring,
 					      (void **)&hdr) != 0)) {
@@ -265,7 +265,7 @@ bucket_adopt_orphans(struct bucket_data *bd)
 		bd->adoption_buffer_rings[rte_lcore_id()];
 
 	if (unlikely(!rte_ring_empty(adopt_ring))) {
-		void *orphan;
+		void *orphan = NULL;
 
 		while (rte_ring_sc_dequeue(adopt_ring, &orphan) == 0) {
 			rc = bucket_enqueue_single(bd, orphan);
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/12 dma/skeleton: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/dma/skeleton/skeleton_dmadev.c:439:24: error:
'desc' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we return -ENOSPC if rte_ring_dequeue() fails, before using the descriptor.

The variables are initialized to allow compiling with "minsize" option.

Fixes 05d5fc66a269 ("dma/skeleton: introduce skeleton driver")
Fixes e1d7b79a246c ("dma/skeleton: support scatter-gather copy")
Fixes 0335480f5bac ("dma/skeleton: support fill operation")
---
 drivers/dma/skeleton/skeleton_dmadev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/skeleton/skeleton_dmadev.c +3 -3
index e287802eb9..b5c7155fc7 100644
@@ -423,7 +423,7 @@ skeldma_copy(void *dev_private, uint16_t vchan,
 	     uint32_t length, uint64_t flags)
 {
 	struct skeldma_hw *hw = dev_private;
-	struct skeldma_desc *desc;
+	struct skeldma_desc *desc = NULL;
 	int ret;
 
 	RTE_SET_USED(vchan);
@@ -454,7 +454,7 @@ skeldma_copy_sg(void *dev_private, uint16_t vchan,
 		uint64_t flags)
 {
 	struct skeldma_hw *hw = dev_private;
-	struct skeldma_desc *desc;
+	struct skeldma_desc *desc = NULL;
 	int ret;
 
 	RTE_SET_USED(vchan);
@@ -483,7 +483,7 @@ skeldma_fill(void *dev_private, uint16_t vchan,
 	     uint32_t length, uint64_t flags)
 {
 	struct skeldma_hw *hw = dev_private;
-	struct skeldma_desc *desc;
+	struct skeldma_desc *desc = NULL;
 	int ret;
 
 	RTE_SET_USED(vchan);
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/12 dma/dpaa: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/dma/dpaa/dpaa_qdma.c:564:48: error:
'dq_complete' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we leave the loop if rte_ring_dequeue() fails, before using dq_complete.

The variable is initialized to allow compiling with "minsize" option.

Fixes f1d30e2786b6 ("dma/dpaa: refactor driver")
---
 drivers/dma/dpaa/dpaa_qdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dpaa/dpaa_qdma.c +1 -1
index d8bece700a..6474dcd9c8 100644
@@ -533,7 +533,7 @@ dpaa_qdma_block_dequeue(struct fsl_qdma_engine *fsl_qdma,
 	uint32_t reg;
 	int ret;
 	uint8_t *block;
-	uint16_t *dq_complete;
+	uint16_t *dq_complete = NULL;
 	struct fsl_qdma_desc *desc[FSL_QDMA_SG_MAX_ENTRY];
 
 	stat_queue = &fsl_qdma->stat_queues[block_id];
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/12 net/softnic: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/net/softnic/rte_eth_softnic_thread.c:275:16: error:
'rsp' may be used uninitialized [-Werror=maybe-uninitialized] drivers/net/softnic/rte_eth_softnic_thread.c:500:20: error:
'req' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because the ring dequeue status is checked before the values are used.

The variables are initialized to allow compiling with "minsize" option.

Fixes 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
Fixes 5719a615dc02 ("net/softnic: add run API")
---
 drivers/net/softnic/rte_eth_softnic_thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/softnic/rte_eth_softnic_thread.c +2 -2
index a6d47c8b33..1e7fa4cf65 100644
@@ -259,7 +259,7 @@ thread_msg_send_recv(struct pmd_internals *softnic,
 	struct softnic_thread *t = &softnic->thread[thread_id];
 	struct rte_ring *msgq_req = t->msgq_req;
 	struct rte_ring *msgq_rsp = t->msgq_rsp;
-	struct thread_msg_rsp *rsp;
+	struct thread_msg_rsp *rsp = NULL;
 	int status;
 
 	/* send */
@@ -425,7 +425,7 @@ softnic_thread_pipeline_disable(struct pmd_internals *softnic,
 static inline struct thread_msg_req *
 thread_msg_recv(struct rte_ring *msgq_req)
 {
-	struct thread_msg_req *req;
+	struct thread_msg_req *req = NULL;
 
 	int status = rte_ring_sc_dequeue(msgq_req, (void **)&req);
 
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/12 net/nfp: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/net/nfp/nfpcore/nfp_elf.c:920:35: error:
'sh_type' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because sh_type is only read after a section was found in the loop.

The variable is initialized to allow compiling with "minsize" option.

Fixes c82ca09c441c ("net/nfp: add ELF module")
---
 drivers/net/nfp/nfpcore/nfp_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/nfp/nfpcore/nfp_elf.c +1 -1
index 522b025f92..549bb7a922 100644
@@ -899,7 +899,7 @@ static int
 nfp_elf_read_first_symtab(struct nfp_elf *ectx)
 {
 	size_t idx;
-	uint32_t sh_type;
+	uint32_t sh_type = 0;
 	uint64_t sh_size;
 	struct nfp_elf_elf64_shdr *sec = NULL;
 
Signature · 1 line
2.43.0
#7 lore raw

PATCH 7/12 net/pcap: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/net/pcap/pcap_ethdev.c:286:33: error:
'pcap_buf' may be used uninitialized [-Werror=maybe-uninitialized] drivers/net/pcap/pcap_ethdev.c:1141:17: error:
'bufs' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because the ring dequeue status is checked before the mbuf pointers are used.

The variables are initialized to allow compiling with "minsize" option.

Fixes a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
Fixes f62490e64d60 ("net/pcap: fix infinite Rx with large files")
---
 drivers/net/pcap/pcap_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/pcap/pcap_ethdev.c +2 -2
index 1e114e0008..671218e31c 100644
@@ -277,7 +277,7 @@ eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		return 0;
 
 	for (i = 0; i < nb_pkts; i++) {
-		struct rte_mbuf *pcap_buf;
+		struct rte_mbuf *pcap_buf = NULL;
 		int err = rte_ring_dequeue(pcap_q->pkts, (void **)&pcap_buf);
 		if (err)
 			return i;
@@ -1135,7 +1135,7 @@ eth_stats_reset(struct rte_eth_dev *dev)
 static inline void
 infinite_rx_ring_free(struct rte_ring *pkts)
 {
-	struct rte_mbuf *bufs;
+	struct rte_mbuf *bufs = NULL;
 
 	while (!rte_ring_dequeue(pkts, (void **)&bufs))
 		rte_pktmbuf_free(bufs);
Signature · 1 line
2.43.0
#8 lore raw

PATCH 8/12 net/mlx5: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/net/mlx5/mlx5_flow_hw.c:13656:38: error:
'age_idx' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we stop the loop if rte_ring_dequeue_elem() fails, before using age_idx.

The variable is initialized to allow compiling with "minsize" option.

Fixes 04a4de756e14 ("net/mlx5: support flow age action with HWS")
---
 drivers/net/mlx5/mlx5_flow_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +1 -1
index 6e6bf07799..6da09bc5eb 100644
@@ -13648,7 +13648,7 @@ flow_hw_get_q_aged_flows(struct rte_eth_dev *dev, uint32_t queue_id,
 	if (nb_contexts == 0)
 		return rte_ring_count(r);
 	while ((uint32_t)nb_flows < nb_contexts) {
-		uint32_t age_idx;
+		uint32_t age_idx = 0;
 
 		if (rte_ring_dequeue_elem(r, &age_idx, sizeof(uint32_t)) < 0)
 			break;
Signature · 1 line
2.43.0
#9 lore raw

PATCH 9/12 crypto/mlx5: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/crypto/mlx5/mlx5_crypto_gcm.c:704:20: error:
'total_len' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we return an error if building the KLM list fails, before using total_len.

The variable is initialized to allow compiling with "minsize" option.

Fixes b01095830734 ("crypto/mlx5: add GCM enqueue/dequeue operations")
---
 drivers/crypto/mlx5/mlx5_crypto_gcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/mlx5/mlx5_crypto_gcm.c +1 -1
index 1a2600655a..e4c7baa718 100644
@@ -680,7 +680,7 @@ mlx5_crypto_gcm_build_umr(struct mlx5_crypto_qp *qp,
 	struct mlx5_klm *iklm;
 	struct mlx5_klm *klm = &qp->klm_array[idx * priv->max_klm_num];
 	uint16_t klm_size, klm_align;
-	uint32_t total_len;
+	uint32_t total_len = 0;
 
 	/* Build KLM base on the op. */
 	klm_size = mlx5_crypto_gcm_build_op_klm(qp, op, op_info, klm, &total_len);
Signature · 1 line
2.43.0
#10 lore raw

PATCH 10/12 crypto/ccp: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

drivers/crypto/ccp/ccp_crypto.c:2897:31: error:
'b_info' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because we return early if rte_ring_dequeue() fails, before using b_info.

The variable is initialized to allow compiling with "minsize" option.

Fixes 70f0f8a8d78c ("crypto/ccp: support burst enqueue/dequeue")
---
 drivers/crypto/ccp/ccp_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/ccp_crypto.c +1 -1
index f966335be5..23a800a38c 100644
@@ -2881,7 +2881,7 @@ process_ops_to_dequeue(struct ccp_qp *qp,
 		       uint16_t nb_ops,
 		       uint16_t *total_nb_ops)
 {
-	struct ccp_batch_info *b_info;
+	struct ccp_batch_info *b_info = NULL;
 	uint32_t cur_head_offset;
 
 	if (qp->b_info != NULL) {
Signature · 1 line
2.43.0
#11 lore raw

PATCH 11/12 common/cnxk: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

In function 'on_fill_ipsec_common_sa':
drivers/common/cnxk/cnxk_security.c:1024:3: error:
'cipher_key' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because cipher_key is only used when cipher_key_len is non-zero, which implies it was assigned.

The variable is initialized to allow compiling with "minsize" option.

Fixes 532963b80707 ("crypto/cnxk: move IPsec SA creation to common")
---
 drivers/common/cnxk/cnxk_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/cnxk/cnxk_security.c +1 -1
index ed5d7d0ba3..b1d267cb81 100644
@@ -974,7 +974,7 @@ on_fill_ipsec_common_sa(struct rte_security_ipsec_xform *ipsec,
 			struct roc_ie_on_common_sa *common_sa)
 {
 	struct rte_crypto_sym_xform *cipher_xform, *auth_xform;
-	const uint8_t *cipher_key;
+	const uint8_t *cipher_key = NULL;
 	int cipher_key_len = 0;
 	uint8_t ccm_flag = 0;
 	int ret;
Signature · 1 line
2.43.0
#12 lore raw

PATCH 12/12 test/bonding: fix minsize build

In reply to Cheryl Bansal

This error is seen in build of type "minsize":

app/test/test_link_bonding_mode4.c:1596:41: error:
'pkt' may be used uninitialized [-Werror=maybe-uninitialized]

It looks to be a compiler issue because pkt is only used when rte_ring_dequeue() succeeded.

The variable is initialized to allow compiling with "minsize" option.

Fixes 5e41ab250dfa ("app/test: unit tests for bonding mode 4")
---
 app/test/test_link_bonding_mode4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_link_bonding_mode4.c +1 -1
index ff13dbed93..ce5eb60599 100644
@@ -1566,7 +1566,7 @@ test_mode4_executor(int (*test_func)(void))
 	struct member_conf *port;
 	int test_result;
 	uint8_t i;
-	void *pkt;
+	void *pkt = NULL;
 
 	/* Check if environment is clean. Fail to launch a test if there was
 	 * a critical error before that prevented to reset environment. */
Signature · 1 line
2.43.0
#13 lore raw
In reply to Cheryl Bansal
Quoted 4 lines · On Mon, 30 Nov 2026 14:01:31 +0530 Cheryl Bansal <[email protected]>…

With gcc 13, --buildtype=minsize and -Werror, the build fails with -Wmaybe-uninitialized in the 12 places below. Each variable is set before it is used. gcc does not see that under minsize, so initialize it. Behavior is unchanged.

I am ok with workaround but this is a compiler bug. I can repro this with 13.5.0
Note: GCC 13.5 is last planned point release for that series. Don't expect any future fixes.

I don't see any of this with minsize builds on later version of Gcc.