public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* re: lpfc: Add support for ELS LCB.
@ 2015-06-10 15:44 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-06-10 15:44 UTC (permalink / raw)
  To: james.smart; +Cc: linux-scsi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-10 15:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 15:44 lpfc: Add support for ELS LCB Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox