DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] pipeline: fix calloc parameters
@ 2023-11-02 13:08 Ferruh Yigit
  2023-11-02 13:08 ` [PATCH 2/2] net/nfp: " Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Ferruh Yigit @ 2023-11-02 13:08 UTC (permalink / raw)
  To: Cristian Dumitrescu, Kamalakannan R; +Cc: dev, stable

gcc [1] generates warning [2] about calloc usage, because calloc
parameter order is wrong, fixing it by replacing parameters.

[1]
gcc (GCC) 14.0.0 20231102 (experimental)

[2]
 Compiling C object .../pipeline_rte_swx_pipeline_spec.c.o
.../rte_swx_pipeline_spec.c: In function ‘pipeline_spec_parse’:
../lib/pipeline/rte_swx_pipeline_spec.c:2893:11:
  warning: allocation of insufficient size ‘1’ for type
           ‘struct pipeline_spec’ with size ‘144’ [-Walloc-size]
 2893 |         s = calloc(sizeof(struct pipeline_spec), 1);
      |           ^

.../rte_swx_pipeline_spec.c: In function ‘pipeline_iospec_parse’:
../lib/pipeline/rte_swx_pipeline_spec.c:4244:11:
  warning: allocation of insufficient size ‘1’ for type
           ‘struct pipeline_iospec’ with size ‘64’ [-Walloc-size]
 4244 |         s = calloc(sizeof(struct pipeline_iospec), 1);
      |           ^

Fixes: 30c4abb90942 ("pipeline: rework specification file-based pipeline build")
Fixes: 54cae37ef4ef ("pipeline: support I/O specification")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
Cc: cristian.dumitrescu@intel.com
---
 lib/pipeline/rte_swx_pipeline_spec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline_spec.c b/lib/pipeline/rte_swx_pipeline_spec.c
index 2bba0d0524d0..17419e7b854b 100644
--- a/lib/pipeline/rte_swx_pipeline_spec.c
+++ b/lib/pipeline/rte_swx_pipeline_spec.c
@@ -2890,7 +2890,7 @@ pipeline_spec_parse(FILE *spec,
 	}
 
 	/* Memory allocation. */
-	s = calloc(sizeof(struct pipeline_spec), 1);
+	s = calloc(1, sizeof(struct pipeline_spec));
 	if (!s) {
 		if (err_line)
 			*err_line = n_lines;
@@ -4241,7 +4241,7 @@ pipeline_iospec_parse(FILE *spec,
 	}
 
 	/* Memory allocation. */
-	s = calloc(sizeof(struct pipeline_iospec), 1);
+	s = calloc(1, sizeof(struct pipeline_iospec));
 	if (!s) {
 		if (err_line)
 			*err_line = n_lines;
-- 
2.34.1


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

end of thread, other threads:[~2024-02-18 16:08 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 13:08 [PATCH 1/2] pipeline: fix calloc parameters Ferruh Yigit
2023-11-02 13:08 ` [PATCH 2/2] net/nfp: " Ferruh Yigit
2023-11-03  1:26   ` Chaoyong He
2023-11-06 14:26 ` [PATCH 1/2] pipeline: " Dumitrescu, Cristian
2024-01-24 18:53 ` [PATCH v2 1/8] " Ferruh Yigit
2024-01-24 18:53   ` [PATCH v2 2/8] net/nfp: " Ferruh Yigit
2024-01-24 19:01     ` Morten Brørup
2024-01-24 18:54   ` [PATCH v2 3/8] rawdev: " Ferruh Yigit
2024-01-24 18:59     ` Morten Brørup
2024-01-25  2:34     ` fengchengwen
2024-01-25  3:39     ` Hemant Agrawal
2024-01-24 18:54   ` [PATCH v2 4/8] eventdev: " Ferruh Yigit
2024-01-24 18:59     ` Morten Brørup
2024-01-25  2:34     ` fengchengwen
2024-01-24 18:54   ` [PATCH v2 5/8] dmadev: " Ferruh Yigit
2024-01-24 18:59     ` Morten Brørup
2024-01-25  2:35     ` fengchengwen
2024-01-24 18:54   ` [PATCH v2 6/8] common/mlx5: " Ferruh Yigit
2024-01-24 19:01     ` Morten Brørup
2024-01-26 10:12       ` Dariusz Sosnowski
2024-01-24 18:54   ` [PATCH v2 7/8] net/bnx2x: " Ferruh Yigit
2024-01-24 19:01     ` Morten Brørup
2024-01-24 18:54   ` [PATCH v2 8/8] net/sfc: " Ferruh Yigit
2024-01-24 19:02     ` Morten Brørup
2024-01-25  7:10       ` Andrew Rybchenko
2024-01-24 19:00   ` [PATCH v2 1/8] pipeline: " Morten Brørup
2024-02-18 16:08   ` 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).