All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Saleem, Shiraz" <shiraz.saleem@intel.com>
Cc: coverity-bot <keescook@chromium.org>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>,
	"Nikolova, Tatyana E" <tatyana.e.nikolova@intel.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>
Subject: Re: Coverity: irdma_fill_device_info(): Null pointer dereferences
Date: Tue, 15 Jun 2021 13:01:59 -0300	[thread overview]
Message-ID: <20210615160159.GV1002214@nvidia.com> (raw)
In-Reply-To: <6bdaf0a1b0e74782b63afba1ecbdd348@intel.com>

On Tue, Jun 15, 2021 at 03:58:52PM +0000, Saleem, Shiraz wrote:
> > Subject: Coverity: irdma_fill_device_info(): Null pointer dereferences
> > 
> > Hello!
> > 
> > This is an experimental semi-automated report about issues detected by Coverity
> > from a scan of next-20210608 as part of the linux-next scan project:
> > https://scan.coverity.com/projects/linux-next-weekly-scan
> > 
> > You're getting this email because you were associated with the identified lines of
> > code (noted below) that were touched by commits:
> > 
> >   Wed Jun 2 19:55:16 2021 -0300
> >     8498a30e1b94 ("RDMA/irdma: Register auxiliary driver and implement private
> > channel OPs")
> > 
> > Coverity reported the following:
> > 
> > *** CID 1505164:  Null pointer dereferences  (NULL_RETURNS)
> > /drivers/infiniband/hw/irdma/main.c: 230 in irdma_fill_device_info()
> > 224     	rf->gen_ops.register_qset = irdma_lan_register_qset;
> > 225     	rf->gen_ops.unregister_qset = irdma_lan_unregister_qset;
> > 226     	rf->hw.hw_addr = pf->hw.hw_addr;
> > 227     	rf->pcidev = pf->pdev;
> > 228     	rf->msix_count =  pf->num_rdma_msix;
> > 229     	rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector];
> > vvv     CID 1505164:  Null pointer dereferences  (NULL_RETURNS)
> > vvv     Dereferencing "vsi", which is known to be "NULL".
> 
> This is a false +ve IMO.

It is because of this:

static inline struct ice_vsi *ice_get_main_vsi(struct ice_pf *pf)
{
        if (pf->vsi)
                return pf->vsi[0];

        return NULL;
}

If the above can't return null it should be rewritten

If something special about this case prevents null it should be
reworked in some way?

Jason

  reply	other threads:[~2021-06-15 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 17:56 Coverity: irdma_fill_device_info(): Null pointer dereferences coverity-bot
2021-06-15 15:58 ` Saleem, Shiraz
2021-06-15 16:01   ` Jason Gunthorpe [this message]
2021-06-17 14:18     ` Saleem, Shiraz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210615160159.GV1002214@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=shiraz.saleem@intel.com \
    --cc=tatyana.e.nikolova@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.