[bug report] target/tcm_loop: Use target_submit_tmr() instead of open-coding this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Bart Van Assche,

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

The patch 75f141aaf48e: "target/tcm_loop: Use target_submit_tmr()
instead of open-coding this function" from May 23, 2017, leads to the
following Smatch complaint:

drivers/target/loopback/tcm_loop.c:247 tcm_loop_issue_tmr()
	 warn: variable dereferenced before check 'se_cmd' (see line 234)

drivers/target/loopback/tcm_loop.c
   223          tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL);
   224          if (!tl_cmd) {
   225                  pr_err("Unable to allocate memory for tl_cmd\n");
   226                  return ret;
   227          }
   228  
   229          init_completion(&tl_cmd->tmr_done);
   230  
   231          se_cmd = &tl_cmd->tl_se_cmd;
   232          se_sess = tl_tpg->tl_nexus->se_sess;
   233	
   234		rc = target_submit_tmr(se_cmd, se_sess, tl_cmd->tl_sense_buf, lun,
                                       ^^^^^^
Dereferenced here.

   235				       NULL, tmr, GFP_KERNEL, task,
   236				       TARGET_SCF_ACK_KREF);
   237		if (rc < 0)
   238			goto release;
   239		wait_for_completion(&tl_cmd->tmr_done);
   240		ret = se_cmd->se_tmr_req->response;
   241		target_put_sess_cmd(se_cmd);
   242	
   243	out:
   244		return ret;
   245	
   246	release:
   247		if (se_cmd)
   248			transport_generic_free_cmd(se_cmd, 0);
   249		else
   250                  kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is dead code.

   251          goto out;
   252  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux