public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.
@ 2017-02-27 16:47 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-02-27 16:47 UTC (permalink / raw)
  To: chad.dupuis; +Cc: linux-scsi

Hello Dupuis, Chad,

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

The patch 61d8658b4a43: "scsi: qedf: Add QLogic FastLinQ offload FCoE 
driver framework." from Feb 15, 2017, leads to the following Smatch 
complaint:

drivers/scsi/qedf/qedf_main.c:1565 qedf_vport_destroy()
	 warn: variable dereferenced before check 'vn_port->host' (see line 1551)

drivers/scsi/qedf/qedf_main.c
  1550		/* Detach from scsi-ml */
  1551		fc_remove_host(vn_port->host);
                               ^^^^^^^^^^^^^
Dereferenced inside function.

  1552		scsi_remove_host(vn_port->host);
  1553	
  1554		/*
  1555		 * Only try to release the exchange manager if the vn_port
  1556		 * configuration is complete.
  1557		 */
  1558		if (vn_port->state == LPORT_ST_READY)
  1559			fc_exch_mgr_free(vn_port);
  1560	
  1561		/* Free memory used by statistical counters */
  1562		fc_lport_free_stats(vn_port);
  1563	
  1564		/* Release Scsi_Host */
  1565		if (vn_port->host)
                    ^^^^^^^^^^^^^
Too late.

  1566			scsi_host_put(vn_port->host);
  1567	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [bug report] scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.
@ 2017-03-02 20:28 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2017-03-02 20:28 UTC (permalink / raw)
  To: chad.dupuis; +Cc: linux-scsi

Hello Dupuis, Chad,

The patch 61d8658b4a43: "scsi: qedf: Add QLogic FastLinQ offload FCoE
driver framework." from Feb 15, 2017, leads to the following static
checker warning:

	drivers/scsi/qedf/qedf_main.c:1168 qedf_rport_event_handler()
	warn: 'rval' can be either negative or positive

drivers/scsi/qedf/qedf_main.c
  1005  static int qedf_offload_connection(struct qedf_ctx *qedf,
  1006          struct qedf_rport *fcport)
  1007  {
  1008          struct qed_fcoe_params_offload conn_info;
  1009          u32 port_id;
  1010          u8 lport_src_id[3];
  1011          int rval;
  1012          uint16_t total_sqe = (fcport->sq_mem_size / sizeof(struct fcoe_wqe));
  1013  
  1014          QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Offloading connection "
  1015                     "portid=%06x.\n", fcport->rdata->ids.port_id);
  1016          rval = qed_ops->acquire_conn(qedf->cdev, &fcport->handle,
  1017              &fcport->fw_cid, &fcport->p_doorbell);
  1018          if (rval) {
  1019                  QEDF_WARN(&(qedf->dbg_ctx), "Could not acquire connection "
  1020                             "for portid=%06x.\n", fcport->rdata->ids.port_id);
  1021                  rval = 1; /* For some reason qed returns 0 on failure here */

What kind of an error is 1 supposed to indicate?  This needs to be
not a magic number and commented.

  1022                  goto out;
  1023          }
  1024  
  1025          QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "portid=%06x "
  1026                     "fw_cid=%08x handle=%d.\n", fcport->rdata->ids.port_id,
  1027                     fcport->fw_cid, fcport->handle);
  1028  
  1029          memset(&conn_info, 0, sizeof(struct qed_fcoe_params_offload));
  1030  

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-02 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-02 20:28 [bug report] scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2017-02-27 16:47 Dan Carpenter

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