Skip to contentSkip to conversation

scsi: lpfc: Add registration for CPU Offline/Online events

bug report Dan Carpenter 1 participant 1 message Nov 8, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

Hello James Smart,

This is a semi-automatic email about new static checker warnings.

The patch 93a4d6f40198: "scsi: lpfc: Add registration for CPU Offline/Online events" from Nov 4, 2019, leads to the following Smatch complaint:

    drivers/scsi/lpfc/lpfc_init.c:11873 lpfc_sli4_hba_unset()
    warn: variable dereferenced before check 'phba->pport' (see line 11844)

drivers/scsi/lpfc/lpfc_init.c
11843 /* per-phba callback de-registration for hotplug event */

 11844		lpfc_cpuhp_remove(phba);
                                  ^^^^

New dereference of "phba->pport" inside this function.

11845
11846 /* Disable PCI subsystem interrupt */
11847 lpfc_sli4_disable_intr(phba);
11848
11849 /* Disable SR-IOV if enabled */
11850 if (phba->cfg_sriov_nr_virtfn)
11851 pci_disable_sriov(pdev);
11852
11853 /* Stop kthread signal shall trigger work_done one more time */
11854 kthread_stop(phba->worker_thread);
11855
11856 /* Disable FW logging to host memory */
11857 lpfc_ras_stop_fwlog(phba);
11858
11859 /* Unset the queues shared with the hardware then release all
11860 * allocated resources.
11861 */
11862 lpfc_sli4_queue_unset(phba);
11863 lpfc_sli4_queue_destroy(phba);
11864
11865 /* Reset SLI4 HBA FCoE function */
11866 lpfc_pci_function_reset(phba);
11867
11868 /* Free RAS DMA memory */
11869 if (phba->ras_fwlog.ras_enabled)
11870 lpfc_sli4_ras_dma_free(phba);
11871
11872 /* Stop the SLI4 device port */
11873 if (phba->pport)

                    ^^^^^^^^^^^

The old code used to check for NULL.

11874 phba->pport->work_port_events = 0;
11875 }

regards,
dan carpenter