[v2,01/13] ethdev: fix incorrect argument of calloc
Checks
Commit Message
The 'calloc' uses number as first argument, sizeof is generally wrong.
This patch fixes it.
Fixes: 8af559f94cef ("ethdev: support telemetry private dump")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 6/7/2023 8:41 AM, Jie Hai wrote:
> The 'calloc' uses number as first argument, sizeof is generally wrong.
> This patch fixes it.
>
> Fixes: 8af559f94cef ("ethdev: support telemetry private dump")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jie Hai <haijie1@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;
>
Functionality should be same, but there is no harm to fix, hence:
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
@@ -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;