scsi: ibmvscsis: Issues from Dan Carpenter/Smatch
authorMichael Cyr <mikecyr@us.ibm.com>
Thu, 13 Oct 2016 16:02:43 +0000 (11:02 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Nov 2016 22:29:54 +0000 (17:29 -0500)
Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Steven Royer <seroyer@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

index fe220a1450799bd343e04d4ed6424264ff41a47c..c9fa3565c671e9f1b0f4e16e847c713cd6165078 100644 (file)
@@ -1896,14 +1896,7 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
 
                pr_debug("mad: type %d\n", be32_to_cpu(mad->type));
 
-               if (be16_to_cpu(mad->length) < 0) {
-                       dev_err(&vscsi->dev, "mad: length is < 0\n");
-                       ibmvscsis_post_disconnect(vscsi,
-                                                 ERR_DISCONNECT_RECONNECT, 0);
-                       rc = SRP_VIOLATION;
-               } else {
-                       rc = ibmvscsis_process_mad(vscsi, iue);
-               }
+               rc = ibmvscsis_process_mad(vscsi, iue);
 
                pr_debug("mad: status %hd, rc %ld\n", be16_to_cpu(mad->status),
                         rc);
@@ -2523,7 +2516,6 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi,
                dev_err(&vscsi->dev, "0x%llx: parsing SRP descriptor table failed.\n",
                        srp->tag);
                goto fail;
-               return;
        }
 
        cmd->rsp.sol_not = srp->sol_not;
@@ -3282,7 +3274,8 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
        INIT_LIST_HEAD(&vscsi->waiting_rsp);
        INIT_LIST_HEAD(&vscsi->active_q);
 
-       snprintf(vscsi->tport.tport_name, 256, "%s", dev_name(&vdev->dev));
+       snprintf(vscsi->tport.tport_name, IBMVSCSIS_NAMELEN, "%s",
+                dev_name(&vdev->dev));
 
        pr_debug("probe tport_name: %s\n", vscsi->tport.tport_name);