Skip to contentSkip to conversation

lpfc: Modularize and cleanup FDMI code in driver

DISCUSSION Dan Carpenter 2 participants 2 messages Feb 1, 2016 – Feb 11, 2016 SCSI

lore
Share & tools
lore
#0 lore raw

Hello James Smart,

The patch 4258e98ee386: "lpfc: Modularize and cleanup FDMI code in driver" from Dec 16, 2015, leads to the following static checker warning:

	drivers/scsi/lpfc/lpfc_ct.c:2547 lpfc_fdmi_cmd()
	error: __memcpy() '&rh->rpl.pe' too small (4 vs 8)

drivers/scsi/lpfc/lpfc_ct.c

  2534          /* Next fill in the specific FDMI cmd information */
  2535          switch (cmdcode) {
  2536          case SLI_MGMT_RHAT:
  2537          case SLI_MGMT_RHBA:
  2538                  rh = (struct lpfc_fdmi_reg_hba *)&CtReq->un.PortID;
  2539                  /* HBA Identifier */
  2540                  memcpy(&rh->hi.PortName, &phba->pport->fc_sparam.portName,
  2541                         sizeof(struct lpfc_name));
  2542  
  2543                  if (cmdcode == SLI_MGMT_RHBA) {
  2544                          /* Registered Port List */
  2545                          /* One entry (port) per adapter */
  2546                          rh->rpl.EntryCnt = cpu_to_be32(1);
  2547                          memcpy(&rh->rpl.pe, &phba->pport->fc_sparam.portName,
                                       ^^^^^^^^^^^

.pe is a u32.

  2548                                 sizeof(struct lpfc_name));
                                       ^^^^^^^^^^^^^^^^^^^^^^^^

lpfc_name is an 8 byte union.

2549

regards,
dan carpenter

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dan" == Dan Carpenter <[email protected]> writes:

Dick,

Please look into this...

---8<---

The patch 4258e98ee386: "lpfc: Modularize and cleanup FDMI code in driver" from Dec 16, 2015, leads to the following static checker warning:

	drivers/scsi/lpfc/lpfc_ct.c:2547 lpfc_fdmi_cmd()
	error: __memcpy() '&rh->rpl.pe' too small (4 vs 8)

drivers/scsi/lpfc/lpfc_ct.c

  2534          /* Next fill in the specific FDMI cmd information */
  2535          switch (cmdcode) {
  2536          case SLI_MGMT_RHAT:
  2537          case SLI_MGMT_RHBA:
  2538                  rh = (struct lpfc_fdmi_reg_hba *)&CtReq->un.PortID;
  2539                  /* HBA Identifier */
  2540                  memcpy(&rh->hi.PortName, &phba->pport->fc_sparam.portName,
  2541                         sizeof(struct lpfc_name));
  2542  
  2543                  if (cmdcode == SLI_MGMT_RHBA) {
  2544                          /* Registered Port List */
  2545                          /* One entry (port) per adapter */
  2546                          rh->rpl.EntryCnt = cpu_to_be32(1);
  2547                          memcpy(&rh->rpl.pe, &phba->pport->fc_sparam.portName,
                                       ^^^^^^^^^^^

.pe is a u32.

  2548                                 sizeof(struct lpfc_name));
                                       ^^^^^^^^^^^^^^^^^^^^^^^^

lpfc_name is an 8 byte union.

2549

regards,
dan carpenter

---8<---

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering