Skip to contentSkip to conversation

dmadev: replace zero length array

PATCH Applied Stephen Hemminger 5 participants 5 messages Oct 15, 2025 – Oct 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmadev: replace zero length array

Use of zero length arrays is Gcc extension.
Found by zero_length_array.cocci.

Fixes 9674119fbf27 ("dmadev: add enqueue/dequeue operations")
---
 lib/dmadev/rte_dmadev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dmadev/rte_dmadev.h +1 -1
index 30e168825e..8ae9ee031b 100644
@@ -856,7 +856,7 @@ struct rte_dma_op {
 	/** Number of destination segments. */
 	uint16_t nb_dst;
 	/** Source and destination segments. */
-	struct rte_dma_sge src_dst_seg[0];
+	struct rte_dma_sge src_dst_seg[];
 };
 
 #ifdef __cplusplus
Signature · 1 line
2.47.3
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Stephen Hemminger

Use of zero length arrays is Gcc extension.
Found by zero_length_array.cocci.

Fixes 9674119fbf27 ("dmadev: add enqueue/dequeue operations")
---
 lib/dmadev/rte_dmadev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dmadev/rte_dmadev.h +0 -0
index 30e168825e..8ae9ee031b 100644

lib/dmadev/rte_dmadev.h struct rte_dma_op { · line 861

Quoted 7 lines
lib/dmadev/rte_dmadev.h +1 -1
@@ -856,7 +856,7 @@ struct rte_dma_op {
 	/** Number of destination segments. */
 	uint16_t nb_dst;
 	/** Source and destination segments. */
-	struct rte_dma_sge src_dst_seg[0];
+	struct rte_dma_sge src_dst_seg[];
 };
 
#2 lore raw
Quoted 14 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 16 October 2025 10.15

Quoted 10 lines · Stephen Hemminger

Use of zero length arrays is Gcc extension.
Found by zero_length_array.cocci.

Fixes 9674119fbf27 ("dmadev: add enqueue/dequeue operations")
---
 lib/dmadev/rte_dmadev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

lib/dmadev/rte_dmadev.h struct rte_dma_op { · line 861

Quoted 12 lines
lib/dmadev/rte_dmadev.h +1 -1
index 30e168825e..8ae9ee031b 100644
@@ -856,7 +856,7 @@ struct rte_dma_op {
 	/** Number of destination segments. */
 	uint16_t nb_dst;
 	/** Source and destination segments. */
-	struct rte_dma_sge src_dst_seg[0];
+	struct rte_dma_sge src_dst_seg[];
 };
 
#3 lore raw
Quoted 27 lines
Quoted 14 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 16 October 2025 10.15

Quoted 10 lines · Stephen Hemminger

Use of zero length arrays is Gcc extension.
Found by zero_length_array.cocci.

Fixes 9674119fbf27 ("dmadev: add enqueue/dequeue operations")
---
 lib/dmadev/rte_dmadev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

lib/dmadev/rte_dmadev.h struct rte_dma_op { · line 861

Quoted 12 lines
lib/dmadev/rte_dmadev.h +1 -1
index 30e168825e..8ae9ee031b 100644
@@ -856,7 +856,7 @@ struct rte_dma_op {
    /** Number of destination segments. */
    uint16_t nb_dst;
    /** Source and destination segments. */
-   struct rte_dma_sge src_dst_seg[0];
+   struct rte_dma_sge src_dst_seg[];
 };
 
Quoted 1 line

Thanks Stephan,

We should probably add this check to CI.

#4 lore raw

16/10/2025 11:50, Pavan Nikhilesh Bhagavatula:

Quoted 11 lines
Quoted 7 lines

From: Bruce Richardson [mailto:[email protected]]

Quoted 5 lines · Stephen Hemminger

lib/dmadev/rte_dmadev.h struct rte_dma_op { · line 859

Quoted 3 lines
lib/dmadev/rte_dmadev.h +1 -1
-   struct rte_dma_sge src_dst_seg[0];
+   struct rte_dma_sge src_dst_seg[];

Thanks Stephan,

Applied, thanks.

Quoted 1 line

We should probably add this check to CI.

Yes