[PATCH v2] hash: separate param checks in hash create func

Stephen Hemminger stephen at networkplumber.org
Thu Oct 10 19:38:09 CEST 2024


On Thu, 10 Oct 2024 16:46:02 +0000
Niall Meade <niall.meade at intel.com> wrote:

> diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
> index 577b5839d3..2569f7d977 100644
> --- a/lib/hash/rte_cuckoo_hash.c
> +++ b/lib/hash/rte_cuckoo_hash.c
> @@ -190,11 +190,17 @@ rte_hash_create(const struct rte_hash_parameters *params)
>  
>  	/* Check for valid parameters */
>  	if ((params->entries > RTE_HASH_ENTRIES_MAX) ||
> -			(params->entries < RTE_HASH_BUCKET_ENTRIES) ||
> -			(params->name == NULL) ||
> -			(params->key_len == 0)) {
> +			(params->entries < RTE_HASH_BUCKET_ENTRIES)) {
>  		rte_errno = EINVAL;
> -		HASH_LOG(ERR, "%s has invalid parameters", __func__);
> +		HASH_LOG(ERR, "%s() entries (%u) must be in range [%d, %d] inclusive",
> +		__func__, params->entries, RTE_HASH_BUCKET_ENTRIES,
> +		RTE_HASH_ENTRIES_MAX);

Need to indent function args here.

> +		return NULL;
> +	}

Noticed this function is inconstitent about setting rte_errno.
Not sure if it matters.


More information about the dev mailing list