Commit 28168905 authored by Jörn Engel's avatar Jörn Engel Committed by Nicholas Bellinger
Browse files

target: remove obvious warnings



Get rid of a bunch of write-only variables.  In a number of cases I
suspect actual bugs to be present, so I left all of those for a second
look.

(nab: fix lio-core patch fuzz)

Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent f2083241
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -1469,14 +1469,12 @@ static int iscsit_handle_nop_out(
	unsigned char *ping_data = NULL;
	int cmdsn_ret, niov = 0, ret = 0, rx_got, rx_size;
	u32 checksum, data_crc, padding = 0, payload_length;
	u64 lun;
	struct iscsi_cmd *cmd = NULL;
	struct kvec *iov = NULL;
	struct iscsi_nopout *hdr;

	hdr			= (struct iscsi_nopout *) buf;
	payload_length		= ntoh24(hdr->dlength);
	lun			= get_unaligned_le64(&hdr->lun);
	hdr->itt		= be32_to_cpu(hdr->itt);
	hdr->ttt		= be32_to_cpu(hdr->ttt);
	hdr->cmdsn		= be32_to_cpu(hdr->cmdsn);
@@ -1686,13 +1684,11 @@ static int iscsit_handle_task_mgt_cmd(
	struct se_tmr_req *se_tmr;
	struct iscsi_tmr_req *tmr_req;
	struct iscsi_tm *hdr;
	u32 payload_length;
	int out_of_order_cmdsn = 0;
	int ret;
	u8 function;

	hdr			= (struct iscsi_tm *) buf;
	payload_length		= ntoh24(hdr->dlength);
	hdr->itt		= be32_to_cpu(hdr->itt);
	hdr->rtt		= be32_to_cpu(hdr->rtt);
	hdr->cmdsn		= be32_to_cpu(hdr->cmdsn);
@@ -2204,14 +2200,10 @@ static int iscsit_handle_snack(
	struct iscsi_conn *conn,
	unsigned char *buf)
{
	u32 unpacked_lun;
	u64 lun;
	struct iscsi_snack *hdr;

	hdr			= (struct iscsi_snack *) buf;
	hdr->flags		&= ~ISCSI_FLAG_CMD_FINAL;
	lun			= get_unaligned_le64(&hdr->lun);
	unpacked_lun		= scsilun_to_int((struct scsi_lun *)&lun);
	hdr->itt		= be32_to_cpu(hdr->itt);
	hdr->ttt		= be32_to_cpu(hdr->ttt);
	hdr->exp_statsn		= be32_to_cpu(hdr->exp_statsn);
@@ -3511,7 +3503,6 @@ int iscsi_target_tx_thread(void *arg)
	struct iscsi_cmd *cmd = NULL;
	struct iscsi_conn *conn;
	struct iscsi_queue_req *qr = NULL;
	struct se_cmd *se_cmd;
	struct iscsi_thread_set *ts = arg;
	/*
	 * Allow ourselves to be interrupted by SIGINT so that a
@@ -3694,8 +3685,6 @@ check_rsp_state:
				goto transport_err;
			}

			se_cmd = &cmd->se_cmd;

			if (map_sg && !conn->conn_ops->IFMarker) {
				if (iscsit_fe_sendpage_sg(cmd, conn) < 0) {
					conn->tx_response_queue = 0;
+1 −3
Original line number Diff line number Diff line
@@ -882,7 +882,7 @@ fail:
static int __iscsi_target_login_thread(struct iscsi_np *np)
{
	u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0;
	int err, ret = 0, ip_proto, sock_type, set_sctp_conn_flag, stop;
	int err, ret = 0, set_sctp_conn_flag, stop;
	struct iscsi_conn *conn = NULL;
	struct iscsi_login *login;
	struct iscsi_portal_group *tpg = NULL;
@@ -895,8 +895,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
	flush_signals(current);
	set_sctp_conn_flag = 0;
	sock = np->np_socket;
	ip_proto = np->np_ip_proto;
	sock_type = np->np_sock_type;

	spin_lock_bh(&np->np_thread_lock);
	if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
+1 −7
Original line number Diff line number Diff line
@@ -173,13 +173,11 @@ static int iscsi_target_check_login_request(
	struct iscsi_conn *conn,
	struct iscsi_login *login)
{
	int req_csg, req_nsg, rsp_csg, rsp_nsg;
	int req_csg, req_nsg;
	u32 payload_length;
	struct iscsi_login_req *login_req;
	struct iscsi_login_rsp *login_rsp;

	login_req = (struct iscsi_login_req *) login->req;
	login_rsp = (struct iscsi_login_rsp *) login->rsp;
	payload_length = ntoh24(login_req->dlength);

	switch (login_req->opcode & ISCSI_OPCODE_MASK) {
@@ -203,9 +201,7 @@ static int iscsi_target_check_login_request(
	}

	req_csg = (login_req->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2;
	rsp_csg = (login_rsp->flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2;
	req_nsg = (login_req->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK);
	rsp_nsg = (login_rsp->flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK);

	if (req_csg != login->current_stage) {
		pr_err("Initiator unexpectedly changed login stage"
@@ -753,12 +749,10 @@ static int iscsi_target_locate_portal(
	struct iscsi_session *sess = conn->sess;
	struct iscsi_tiqn *tiqn;
	struct iscsi_login_req *login_req;
	struct iscsi_targ_login_rsp *login_rsp;
	u32 payload_length;
	int sessiontype = 0, ret = 0;

	login_req = (struct iscsi_login_req *) login->req;
	login_rsp = (struct iscsi_targ_login_rsp *) login->rsp;
	payload_length = ntoh24(login_req->dlength);

	login->first_request	= 1;
+0 −2
Original line number Diff line number Diff line
@@ -1312,7 +1312,6 @@ static struct configfs_attribute *tcm_loop_wwn_attrs[] = {
static int tcm_loop_register_configfs(void)
{
	struct target_fabric_configfs *fabric;
	struct config_group *tf_cg;
	int ret;
	/*
	 * Set the TCM Loop HBA counter to zero
@@ -1379,7 +1378,6 @@ static int tcm_loop_register_configfs(void)
	fabric->tf_ops.set_fabric_sense_len = &tcm_loop_set_fabric_sense_len;
	fabric->tf_ops.get_fabric_sense_len = &tcm_loop_get_fabric_sense_len;

	tf_cg = &fabric->tf_group;
	/*
	 * Setup function pointers for generic logic in target_core_fabric_configfs.c
	 */
+0 −2
Original line number Diff line number Diff line
@@ -2853,7 +2853,6 @@ static void target_core_drop_subdev(
	struct se_subsystem_dev *se_dev = container_of(to_config_group(item),
				struct se_subsystem_dev, se_dev_group);
	struct se_hba *hba;
	struct se_subsystem_api *t;
	struct config_item *df_item;
	struct config_group *dev_cg, *tg_pt_gp_cg, *dev_stat_grp;
	int i;
@@ -2861,7 +2860,6 @@ static void target_core_drop_subdev(
	hba = item_to_hba(&se_dev->se_dev_hba->hba_group.cg_item);

	mutex_lock(&hba->hba_access_mutex);
	t = hba->transport;

	dev_stat_grp = &se_dev->dev_stat_grps.stat_group;
	for (i = 0; dev_stat_grp->default_groups[i]; i++) {
Loading