> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Friday, April 22, 2016 12:10 AM
> To: Zhang, Helin <helin.zhang at intel.com>
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/6] i40e: fix problematic dereference
> 
> On Thu, 21 Apr 2016 11:42:52 +0800
> Helin Zhang <helin.zhang at intel.com> wrote:
> 
> > Fix issue reported by Coverity.
> >
> > Coverity ID 119267: Dereference before null check.
> >
> > Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage")
> >
> > Signed-off-by: Helin Zhang <helin.zhang at intel.com>
> > ---
> >  drivers/net/i40e/i40e_rxtx.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_rxtx.c
> > b/drivers/net/i40e/i40e_rxtx.c index 4d35d83..9c126a3 100644
> > --- a/drivers/net/i40e/i40e_rxtx.c
> > +++ b/drivers/net/i40e/i40e_rxtx.c
> > @@ -2592,14 +2592,14 @@ i40e_rx_queue_release_mbufs(struct
> > i40e_rx_queue *rxq)  {
> >     uint16_t i;
> >
> > -   /* SSE Vector driver has a different way of releasing mbufs. */
> > -   if (rxq->rx_using_sse) {
> > -           i40e_rx_queue_release_mbufs_vec(rxq);
> > +   if (!rxq || !rxq->sw_ring) {
> > +           PMD_DRV_LOG(DEBUG, "Pointer to rxq or sw_ring is NULL");
> >             return;
> >     }
> >
> 
> I can't see how you could ever trigger this.
>  i40e_rx_queue_release_mbufs() is called only called from places where rxq is
> guraanteed non NULL.
> 
> Are you sure Coverity isn't tell you that?
Coverity just reported " Dereference before null check ", nothing else there.
The function was called several times in different places. It could be safer, 
in case
somebody wrongly give the queue id.
But you are right, it shouldn't happen if nothing wrong.

Are you suggesting to remove rxq check? Thanks!

Regards,
Helin

Reply via email to