All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: james.smart@avagotech.com
Cc: linux-scsi@vger.kernel.org
Subject: re: lpfc: Add support for ELS LCB.
Date: Wed, 10 Jun 2015 18:44:05 +0300	[thread overview]
Message-ID: <20150610154405.GH10549@mwanda> (raw)

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

                 reply	other threads:[~2015-06-10 15:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20150610154405.GH10549@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=james.smart@avagotech.com \
    --cc=linux-scsi@vger.kernel.org \
    /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.