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

Ferruh Yigit ferruh.yigit at amd.com
Wed Jun 7 13:35:21 CEST 2023


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 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;
>  

Functionality should be same, but there is no harm to fix, hence:

Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>


More information about the dev mailing list