[bug report] scsi: lpfc: NVME Initiator: Merge into FC discovery

2017-05-03 Thread Dan Carpenter
Hello James Smart,

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

The patch a0f2d3ef374f: "scsi: lpfc: NVME Initiator: Merge into FC
discovery" from Feb 12, 2017, leads to the following Smatch complaint:

drivers/scsi/lpfc/lpfc_ct.c:982 lpfc_cmpl_ct_cmd_gft_id()
 error: we previously assumed 'ndlp' could be null (see line 966)

drivers/scsi/lpfc/lpfc_ct.c
   965  ndlp = lpfc_findnode_did(vport, did);
   966  if (ndlp) {

Check.

   967  /* The bitmask value for FCP and NVME FCP types 
is
   968   * the same because they are 32 bits distant 
from
   969   * each other in word0 and word0.
   970   */
   971  if (fc4_data_0 & LPFC_FC4_TYPE_BITMASK)
   972  ndlp->nlp_fc4_type |= NLP_FC4_FCP;
   973  if (fc4_data_1 &  LPFC_FC4_TYPE_BITMASK)
   974  ndlp->nlp_fc4_type |= NLP_FC4_NVME;
   975  lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
   976   "3064 Setting ndlp %p, DID 
x%06x with "
   977   "FC4 x%08x, Data: x%08x 
x%08x\n",
   978   ndlp, did, ndlp->nlp_fc4_type,
   979   FC_TYPE_FCP, FC_TYPE_NVME);
   980  ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
   981  }
   982  lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
  
Dereferenced inside the function call.

   983  lpfc_issue_els_prli(vport, ndlp, 0);
   984  } else

regards,
dan carpenter


Re: [bug report] scsi: lpfc: NVME Initiator: Merge into FC discovery

2017-03-04 Thread James Smart



On 2/27/2017 8:34 AM, Dan Carpenter wrote:

Hello James Smart,

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

The patch a0f2d3ef374f: "scsi: lpfc: NVME Initiator: Merge into FC
discovery" from Feb 12, 2017, leads to the following Smatch complaint:




Thanks.  Issues addressed in the lpfc patch set just posted.
see  http://marc.info/?l=linux-scsi=148864868315119=2

-- james



[bug report] scsi: lpfc: NVME Initiator: Merge into FC discovery

2017-02-27 Thread Dan Carpenter
Hello James Smart,

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

The patch a0f2d3ef374f: "scsi: lpfc: NVME Initiator: Merge into FC 
discovery" from Feb 12, 2017, leads to the following Smatch complaint:

drivers/scsi/lpfc/lpfc_ct.c:943 lpfc_cmpl_ct_cmd_gft_id()
 error: we previously assumed 'ndlp' could be null (see line 928)

drivers/scsi/lpfc/lpfc_ct.c
   927  ndlp = lpfc_findnode_did(vport, did);
   928  if (ndlp) {

Check.

   929  /* The bitmask value for FCP and NVME FCP types 
is
   930   * the same because they are 32 bits distant 
from
   931   * each other in word0 and word0.
   932   */
   933  if (fc4_data_0 & LPFC_FC4_TYPE_BITMASK)
   934  ndlp->nlp_fc4_type |= NLP_FC4_FCP;
   935  if (fc4_data_1 &  LPFC_FC4_TYPE_BITMASK)
   936  ndlp->nlp_fc4_type |= NLP_FC4_NVME;
   937  lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
   938   "3064 Setting ndlp %p, DID 
x%06x with "
   939   "FC4 x%08x, Data: x%08x 
x%08x\n",
   940   ndlp, did, ndlp->nlp_fc4_type,
   941   FC_TYPE_FCP, FC_TYPE_NVME);
   942  }
   943  ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;

Not checked.

   944  lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
   945  lpfc_issue_els_prli(vport, ndlp, 0);

drivers/scsi/lpfc/lpfc_nvmet.c:1694 lpfc_nvmet_unsol_issue_abort()
error: we previously assumed 'ndlp' could be null (see line 1690)

drivers/scsi/lpfc/lpfc_nvmet.c
  1688  
  1689  ndlp = lpfc_findnode_did(phba->pport, sid);
  1690  if (!ndlp || !NLP_CHK_NODE_ACT(ndlp) ||
^
Check.

  1691  ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
  1692  (ndlp->nlp_state != NLP_STE_MAPPED_NODE))) {
  1693  atomic_inc(>xmt_abort_rsp_error);
  1694  lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
  1695  "6134 Drop ABTS - wrong NDLP state 
x%x.\n",
  1696  ndlp->nlp_state);
^^^
Potential Oops.

  1697  
  1698  /* No failure to an ABTS request. */
  1699  return 0;
  1700  }

drivers/scsi/lpfc/lpfc_nvmet.c:1792 lpfc_nvmet_sol_fcp_issue_abort()
error: we previously assumed 'ndlp' could be null (see line 1788)

drivers/scsi/lpfc/lpfc_nvmet.c
  1786  
  1787  ndlp = lpfc_findnode_did(phba->pport, sid);
  1788  if (!ndlp || !NLP_CHK_NODE_ACT(ndlp) ||
^
Check.

  1789  ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
  1790  (ndlp->nlp_state != NLP_STE_MAPPED_NODE))) {
  1791  atomic_inc(>xmt_abort_rsp_error);
  1792  lpfc_printf_log(phba, KERN_WARNING, LOG_NVME_ABTS,
  1793  "6160 Drop ABTS - wrong NDLP state 
x%x.\n",
  1794  ndlp->nlp_state);
^^^
Potential Oops.

  1795  
  1796  /* No failure to an ABTS request. */
  1797  return 0;
  1798  }

regards,
dan carpenter