On Mon, 12 Oct 2026 12:34:36 +0530
Prashant Gupta <[email protected]> wrote:
> +
> + /* Check for duplicate ID and insert under lock to prevent TOCTOU. */
> + rte_spinlock_lock(&priv->meter_lock);
> + curr = LIST_FIRST(&priv->profiles);
> + while (curr != NULL) {
> + if (curr->profile_id == profile_id) {
> + rte_spinlock_unlock(&priv->meter_lock);
> + rte_mtr_error_set(error, EEXIST,
> + RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
> + NULL, "Meter profile ID already exists!");
> + ret = -EEXIST;
> + goto err;
> + }
> + curr = LIST_NEXT(curr, next);
> + }
You are just open coding LIST_FOREACH() and other places.
Better to use the macro.