Hello James Smart,

The patch 8b017a30a313: "lpfc: Add support for ELS LCB." from May 21,
2015, leads to the following static checker warning:

        drivers/scsi/lpfc/lpfc_els.c:5243 lpfc_els_rcv_lcb()
        error: potential null dereference 'lcb_context'.  (kmalloc returns null)

drivers/scsi/lpfc/lpfc_els.c
  5205          if (phba->sli_rev < LPFC_SLI_REV4 ||
  5206              (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
  5207              LPFC_SLI_INTF_IF_TYPE_2)) {
  5208                  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5209                  goto rjt;
  5210          }
  5211          lcb_context = kmalloc(sizeof(struct lpfc_lcb_context), 
GFP_KERNEL);
                
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No check for allocation failure.

  5212  
  5213          if (phba->hba_flag & HBA_FCOE_MODE) {
  5214                  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5215                  goto rjt;
  5216          }
  5217          if (beacon->lcb_frequency == 0) {
  5218                  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5219                  goto rjt;
  5220          }
  5221          if ((beacon->lcb_type != LPFC_LCB_GREEN) &&
  5222              (beacon->lcb_type != LPFC_LCB_AMBER)) {

Also:
        drivers/scsi/lpfc/lpfc_els.c:5261 lpfc_els_rcv_lcb()
        warn: possible memory leak of 'lcb_context'

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to