[PATCH v2 01/13] ethdev: fix incorrect argument of calloc

Jie Hai haijie1 at huawei.com
Wed Jun 7 09:41:56 CEST 2023


The 'calloc' uses number as first argument, sizeof is generally wrong.
This patch fixes it.

Fixes: 8af559f94cef ("ethdev: support telemetry private dump")
Cc: stable at dpdk.org

Signed-off-by: Jie Hai <haijie1 at huawei.com>
---
 lib/ethdev/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index d46e74504e64..503d500429c0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6548,7 +6548,7 @@ eth_dev_handle_port_dump_priv(const char *cmd __rte_unused,
 	if (!rte_eth_dev_is_valid_port(port_id))
 		return -EINVAL;
 
-	buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN);
+	buf = calloc(RTE_TEL_MAX_SINGLE_STRING_LEN, sizeof(char));
 	if (buf == NULL)
 		return -ENOMEM;
 
-- 
2.33.0



More information about the dev mailing list