[dpdk-dev] [PATCH 3/5] net/i40e: fix dereference before NULL check in mbuf release

Rami Rosen ramirose at gmail.com
Fri Apr 5 16:08:01 CEST 2019


Acked-By: Rami Rosen <ramirose at gmail.com>

In this occasion I noticed that there is a typo in the code that appears in
the patch;
it should be "Pointer to txq" instead of "Pointer to rxq":
I would consider resending and fixing it on this occasion:

>  if (!txq || !txq->sw_ring) {
>               PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL");
>                return;
>        }






‏<bruce.richardson at intel.com>:

> Coverity flags that the txq variable is used before it's checked for NULL.
>
> Coverity issue: 195023
>
> Fixes: 24853544c84c ("net/i40e: fix mbuf free in vector Tx")
> Cc: qi.z.zhang at intel.com
> CC: stable at dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  drivers/net/i40e/i40e_rxtx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 8f727fae6..5ce85eb52 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -2423,13 +2423,13 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue
> *txq)
>         struct rte_eth_dev *dev;
>         uint16_t i;
>
> -       dev = &rte_eth_devices[txq->port_id];
> -
>         if (!txq || !txq->sw_ring) {
>                 PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL");
>                 return;
>         }
>
> +       dev = &rte_eth_devices[txq->port_id];
> +
>         /**
>          *  vPMD tx will not set sw_ring's mbuf to NULL after free,
>          *  so need to free remains more carefully.
> --
> 2.20.1
>
>


More information about the dev mailing list