[dpdk-dev] [PATCH v10] ethdev: add sanity checks in control APIs

Ferruh Yigit ferruh.yigit at intel.com
Wed Apr 21 16:19:53 CEST 2021


On 4/21/2021 1:36 PM, Min Hu (Connor) wrote:
> This patch adds more sanity checks in control path APIs.
> 
> Fixes: 214ed1acd125 ("ethdev: add iterator to match devargs input")
> Fixes: 3d98f921fbe9 ("ethdev: unify prefix for static functions and variables")
> Fixes: 0366137722a0 ("ethdev: check for invalid device name")
> Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model")
> Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Acked-by: Kevin Traynor <ktraynor at redhat.com>
> Acked-by: Thomas Monjalon <thomas at monjalon.net>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>

<...>

> @@ -3256,6 +3371,13 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>   	dev = &rte_eth_devices[port_id];
>   
> +	if (fw_version == NULL && fw_size > 0) {
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot get ethdev port %u FW version to NULL\n",

In the log problem seems like only 'fw_version' to be NULL but that is not 
exactly corret, what do you think to extend it as we did a few other places in 
this patch

"Cannot get ethdev port %u FW version to NULL when string size is non zero\n"

<...>

> @@ -3323,6 +3451,14 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
>   
>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>   	dev = &rte_eth_devices[port_id];
> +
> +	if (ptypes == NULL && num > 0) {
> +		RTE_ETHDEV_LOG(ERR,
> +			"Cannot get ethdev port %u supported packet types to NULL\n",
> +			port_id);

Ditto. What about:

"Cannot get ethdev port %u supported packet types to NULL when array size is non 
zero\n


More information about the dev mailing list