[PATCH] net/bnxt: simplify NVGRE pointer validation
Kishore Padmanabha
kishore.padmanabha at broadcom.com
Mon Sep 21 21:38:01 CEST 2026
On Tue, Sep 15, 2026 at 5:09 AM Evgeny Sokolov <Evgeny.Sokolov at infotecs.ru>
wrote:
> From: Sokolov Evgeny <Evgeny.Sokolov at infotecs.ru>
>
> Previous validation guarantees that nvgre_spec and nvgre_mask are
> both non-NULL when this code is reached.
>
> Remove the redundant condition and execute the enclosed code
> directly.
>
> Signed-off-by: Sokolov Evgeny <Evgeny.Sokolov at infotecs.ru>
> Cc: stable at dpdk.org
> ---
> drivers/net/bnxt/bnxt_flow.c | 36 +++++++++++++++++-------------------
> 1 file changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
> index a2e590540b..4a38c036de 100644
> --- a/drivers/net/bnxt/bnxt_flow.c
> +++ b/drivers/net/bnxt/bnxt_flow.c
> @@ -632,26 +632,24 @@ bnxt_validate_and_parse_flow_type(const struct
> rte_flow_attr *attr,
> return -rte_errno;
> }
>
> - if (nvgre_spec && nvgre_mask) {
> - tni_masked =
> - !!memcmp(nvgre_mask->tni, tni_mask,
> - RTE_DIM(tni_mask));
> - if (tni_masked) {
> - rte_flow_error_set
> - (error,
> - EINVAL,
> - RTE_FLOW_ERROR_TYPE_ITEM,
> - item,
> - "Invalid TNI mask");
> - return -rte_errno;
> - }
> - rte_memcpy(((uint8_t *)&tenant_id_be + 1),
> - nvgre_spec->tni, 3);
> - filter->vni =
> - rte_be_to_cpu_32(tenant_id_be);
> - filter->tunnel_type =
> -
> CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_NVGRE;
> + tni_masked =
> + !!memcmp(nvgre_mask->tni, tni_mask,
> + RTE_DIM(tni_mask));
> + if (tni_masked) {
> + rte_flow_error_set
> + (error,
> + EINVAL,
> + RTE_FLOW_ERROR_TYPE_ITEM,
> + item,
> + "Invalid TNI mask");
> + return -rte_errno;
> }
> + rte_memcpy(((uint8_t *)&tenant_id_be + 1),
> + nvgre_spec->tni, 3);
> + filter->vni =
> + rte_be_to_cpu_32(tenant_id_be);
> + filter->tunnel_type =
> + CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_NVGRE;
> break;
>
> case RTE_FLOW_ITEM_TYPE_GRE:
> --
Acked-by: Kishore Padmanabha <kishore.padmanabha at broadcom.com>
>
> 2.30.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/stable/attachments/20260921/c2071f4e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5493 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mails.dpdk.org/archives/stable/attachments/20260921/c2071f4e/attachment.bin>
More information about the stable
mailing list