Re: [bug report] RDMA/bnxt_re: Add bnxt_re RoCE driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 31, 2018 at 5:49 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> Hello Selvin Xavier,
>
> The patch 1ac5a4047975: "RDMA/bnxt_re: Add bnxt_re RoCE driver" from
> Feb 10, 2017, leads to the following static checker warning:
>
>         drivers/infiniband/hw/bnxt_re/qplib_fp.c:452 bnxt_qplib_enable_nq()
>         error: we previously assumed 'nq->bar_reg_iomem' could be null (see line 438)
>
> drivers/infiniband/hw/bnxt_re/qplib_fp.c
>    430          nq->bar_reg = NQ_CONS_PCI_BAR_REGION;
>    431          nq->bar_reg_off = bar_reg_offset;
>    432          nq_base = pci_resource_start(pdev, nq->bar_reg);
>    433          if (!nq_base) {
>    434                  rc = -ENOMEM;
>    435                  goto fail;
>    436          }
>    437          nq->bar_reg_iomem = ioremap_nocache(nq_base + nq->bar_reg_off, 4);
>    438          if (!nq->bar_reg_iomem) {
>                      ^^^^^^^^^^^^^^^^^
> NULL here.
>
>    439                  rc = -ENOMEM;
>    440                  goto fail;
>    441          }
>    442
>    443          rc = bnxt_qplib_nq_start_irq(nq, nq_idx, msix_vector, true);
>    444          if (rc) {
>    445                  dev_err(&nq->pdev->dev,
>    446                          "QPLIB: Failed to request irq for nq-idx %d", nq_idx);
>    447                  goto fail;
>    448          }
>    449
>    450          return 0;
>    451  fail:
>    452          bnxt_qplib_disable_nq(nq);
>                                       ^^
> This function checks for NULL but only after it's already been
> dereferenced.  Goto fail is always buggy.
>
Thanks Dan for reporting it. I will fix it.

>    453          return rc;
>
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux