diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 16 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 28 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 5 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 21 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_nego.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_nodeattrib.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_stat.c | 16 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_util.c | 4 | ||||
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 18 | ||||
-rw-r--r-- | drivers/target/target_core_cdb.c | 20 | ||||
-rw-r--r-- | drivers/target/target_core_configfs.c | 18 | ||||
-rw-r--r-- | drivers/target/target_core_fabric_lib.c | 6 | ||||
-rw-r--r-- | drivers/target/target_core_file.c | 10 | ||||
-rw-r--r-- | drivers/target/target_core_iblock.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 14 | ||||
-rw-r--r-- | drivers/target/target_core_stat.c | 3 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 4 |
18 files changed, 90 insertions, 101 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index f74a62d46eea..ac44af165b27 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -283,8 +283,8 @@ static struct iscsi_np *iscsit_get_np( | |||
283 | sock_in6 = (struct sockaddr_in6 *)sockaddr; | 283 | sock_in6 = (struct sockaddr_in6 *)sockaddr; |
284 | sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; | 284 | sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; |
285 | 285 | ||
286 | if (!memcmp((void *)&sock_in6->sin6_addr.in6_u, | 286 | if (!memcmp(&sock_in6->sin6_addr.in6_u, |
287 | (void *)&sock_in6_e->sin6_addr.in6_u, | 287 | &sock_in6_e->sin6_addr.in6_u, |
288 | sizeof(struct in6_addr))) | 288 | sizeof(struct in6_addr))) |
289 | ip_match = 1; | 289 | ip_match = 1; |
290 | 290 | ||
@@ -1224,7 +1224,7 @@ static void iscsit_do_crypto_hash_buf( | |||
1224 | 1224 | ||
1225 | crypto_hash_init(hash); | 1225 | crypto_hash_init(hash); |
1226 | 1226 | ||
1227 | sg_init_one(&sg, (u8 *)buf, payload_length); | 1227 | sg_init_one(&sg, buf, payload_length); |
1228 | crypto_hash_update(hash, &sg, payload_length); | 1228 | crypto_hash_update(hash, &sg, payload_length); |
1229 | 1229 | ||
1230 | if (padding) { | 1230 | if (padding) { |
@@ -1602,7 +1602,7 @@ static int iscsit_handle_nop_out( | |||
1602 | /* | 1602 | /* |
1603 | * Attach ping data to struct iscsi_cmd->buf_ptr. | 1603 | * Attach ping data to struct iscsi_cmd->buf_ptr. |
1604 | */ | 1604 | */ |
1605 | cmd->buf_ptr = (void *)ping_data; | 1605 | cmd->buf_ptr = ping_data; |
1606 | cmd->buf_ptr_size = payload_length; | 1606 | cmd->buf_ptr_size = payload_length; |
1607 | 1607 | ||
1608 | pr_debug("Got %u bytes of NOPOUT ping" | 1608 | pr_debug("Got %u bytes of NOPOUT ping" |
@@ -3196,7 +3196,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | |||
3196 | end_of_buf = 1; | 3196 | end_of_buf = 1; |
3197 | goto eob; | 3197 | goto eob; |
3198 | } | 3198 | } |
3199 | memcpy((void *)payload + payload_len, buf, len); | 3199 | memcpy(payload + payload_len, buf, len); |
3200 | payload_len += len; | 3200 | payload_len += len; |
3201 | 3201 | ||
3202 | spin_lock(&tiqn->tiqn_tpg_lock); | 3202 | spin_lock(&tiqn->tiqn_tpg_lock); |
@@ -3228,7 +3228,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | |||
3228 | end_of_buf = 1; | 3228 | end_of_buf = 1; |
3229 | goto eob; | 3229 | goto eob; |
3230 | } | 3230 | } |
3231 | memcpy((void *)payload + payload_len, buf, len); | 3231 | memcpy(payload + payload_len, buf, len); |
3232 | payload_len += len; | 3232 | payload_len += len; |
3233 | } | 3233 | } |
3234 | spin_unlock(&tpg->tpg_np_lock); | 3234 | spin_unlock(&tpg->tpg_np_lock); |
@@ -3485,7 +3485,7 @@ int iscsi_target_tx_thread(void *arg) | |||
3485 | struct iscsi_conn *conn; | 3485 | struct iscsi_conn *conn; |
3486 | struct iscsi_queue_req *qr = NULL; | 3486 | struct iscsi_queue_req *qr = NULL; |
3487 | struct se_cmd *se_cmd; | 3487 | struct se_cmd *se_cmd; |
3488 | struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; | 3488 | struct iscsi_thread_set *ts = arg; |
3489 | /* | 3489 | /* |
3490 | * Allow ourselves to be interrupted by SIGINT so that a | 3490 | * Allow ourselves to be interrupted by SIGINT so that a |
3491 | * connection recovery / failure event can be triggered externally. | 3491 | * connection recovery / failure event can be triggered externally. |
@@ -3774,7 +3774,7 @@ int iscsi_target_rx_thread(void *arg) | |||
3774 | u8 buffer[ISCSI_HDR_LEN], opcode; | 3774 | u8 buffer[ISCSI_HDR_LEN], opcode; |
3775 | u32 checksum = 0, digest = 0; | 3775 | u32 checksum = 0, digest = 0; |
3776 | struct iscsi_conn *conn = NULL; | 3776 | struct iscsi_conn *conn = NULL; |
3777 | struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; | 3777 | struct iscsi_thread_set *ts = arg; |
3778 | struct kvec iov; | 3778 | struct kvec iov; |
3779 | /* | 3779 | /* |
3780 | * Allow ourselves to be interrupted by SIGINT so that a | 3780 | * Allow ourselves to be interrupted by SIGINT so that a |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 1cd6ce373b83..92a2526f0a20 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -82,7 +82,7 @@ static void chap_gen_challenge( | |||
82 | unsigned int *c_len) | 82 | unsigned int *c_len) |
83 | { | 83 | { |
84 | unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1]; | 84 | unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1]; |
85 | struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | 85 | struct iscsi_chap *chap = conn->auth_protocol; |
86 | 86 | ||
87 | memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); | 87 | memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); |
88 | 88 | ||
@@ -120,7 +120,7 @@ static struct iscsi_chap *chap_server_open( | |||
120 | if (!conn->auth_protocol) | 120 | if (!conn->auth_protocol) |
121 | return NULL; | 121 | return NULL; |
122 | 122 | ||
123 | chap = (struct iscsi_chap *) conn->auth_protocol; | 123 | chap = conn->auth_protocol; |
124 | /* | 124 | /* |
125 | * We only support MD5 MDA presently. | 125 | * We only support MD5 MDA presently. |
126 | */ | 126 | */ |
@@ -172,7 +172,7 @@ static int chap_server_compute_md5( | |||
172 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; | 172 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; |
173 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; | 173 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; |
174 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; | 174 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; |
175 | struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | 175 | struct iscsi_chap *chap = conn->auth_protocol; |
176 | struct crypto_hash *tfm; | 176 | struct crypto_hash *tfm; |
177 | struct hash_desc desc; | 177 | struct hash_desc desc; |
178 | struct scatterlist sg; | 178 | struct scatterlist sg; |
@@ -246,7 +246,7 @@ static int chap_server_compute_md5( | |||
246 | goto out; | 246 | goto out; |
247 | } | 247 | } |
248 | 248 | ||
249 | sg_init_one(&sg, (void *)&chap->id, 1); | 249 | sg_init_one(&sg, &chap->id, 1); |
250 | ret = crypto_hash_update(&desc, &sg, 1); | 250 | ret = crypto_hash_update(&desc, &sg, 1); |
251 | if (ret < 0) { | 251 | if (ret < 0) { |
252 | pr_err("crypto_hash_update() failed for id\n"); | 252 | pr_err("crypto_hash_update() failed for id\n"); |
@@ -254,7 +254,7 @@ static int chap_server_compute_md5( | |||
254 | goto out; | 254 | goto out; |
255 | } | 255 | } |
256 | 256 | ||
257 | sg_init_one(&sg, (void *)&auth->password, strlen(auth->password)); | 257 | sg_init_one(&sg, &auth->password, strlen(auth->password)); |
258 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password)); | 258 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password)); |
259 | if (ret < 0) { | 259 | if (ret < 0) { |
260 | pr_err("crypto_hash_update() failed for password\n"); | 260 | pr_err("crypto_hash_update() failed for password\n"); |
@@ -262,7 +262,7 @@ static int chap_server_compute_md5( | |||
262 | goto out; | 262 | goto out; |
263 | } | 263 | } |
264 | 264 | ||
265 | sg_init_one(&sg, (void *)chap->challenge, CHAP_CHALLENGE_LENGTH); | 265 | sg_init_one(&sg, chap->challenge, CHAP_CHALLENGE_LENGTH); |
266 | ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH); | 266 | ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH); |
267 | if (ret < 0) { | 267 | if (ret < 0) { |
268 | pr_err("crypto_hash_update() failed for challenge\n"); | 268 | pr_err("crypto_hash_update() failed for challenge\n"); |
@@ -304,11 +304,11 @@ static int chap_server_compute_md5( | |||
304 | goto out; | 304 | goto out; |
305 | } | 305 | } |
306 | 306 | ||
307 | /* FIXME: What happens when simple_strtoul() return 256, 257, etc.? */ | ||
307 | if (type == HEX) | 308 | if (type == HEX) |
308 | id = (unsigned char)simple_strtoul((char *)&identifier[2], | 309 | id = simple_strtoul(&identifier[2], &endptr, 0); |
309 | &endptr, 0); | ||
310 | else | 310 | else |
311 | id = (unsigned char)simple_strtoul(identifier, &endptr, 0); | 311 | id = simple_strtoul(identifier, &endptr, 0); |
312 | /* | 312 | /* |
313 | * RFC 1994 says Identifier is no more than octet (8 bits). | 313 | * RFC 1994 says Identifier is no more than octet (8 bits). |
314 | */ | 314 | */ |
@@ -351,7 +351,7 @@ static int chap_server_compute_md5( | |||
351 | goto out; | 351 | goto out; |
352 | } | 352 | } |
353 | 353 | ||
354 | sg_init_one(&sg, (void *)&id, 1); | 354 | sg_init_one(&sg, &id, 1); |
355 | ret = crypto_hash_update(&desc, &sg, 1); | 355 | ret = crypto_hash_update(&desc, &sg, 1); |
356 | if (ret < 0) { | 356 | if (ret < 0) { |
357 | pr_err("crypto_hash_update() failed for id\n"); | 357 | pr_err("crypto_hash_update() failed for id\n"); |
@@ -359,7 +359,7 @@ static int chap_server_compute_md5( | |||
359 | goto out; | 359 | goto out; |
360 | } | 360 | } |
361 | 361 | ||
362 | sg_init_one(&sg, (void *)auth->password_mutual, | 362 | sg_init_one(&sg, auth->password_mutual, |
363 | strlen(auth->password_mutual)); | 363 | strlen(auth->password_mutual)); |
364 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual)); | 364 | ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual)); |
365 | if (ret < 0) { | 365 | if (ret < 0) { |
@@ -371,7 +371,7 @@ static int chap_server_compute_md5( | |||
371 | /* | 371 | /* |
372 | * Convert received challenge to binary hex. | 372 | * Convert received challenge to binary hex. |
373 | */ | 373 | */ |
374 | sg_init_one(&sg, (void *)challenge_binhex, challenge_len); | 374 | sg_init_one(&sg, challenge_binhex, challenge_len); |
375 | ret = crypto_hash_update(&desc, &sg, challenge_len); | 375 | ret = crypto_hash_update(&desc, &sg, challenge_len); |
376 | if (ret < 0) { | 376 | if (ret < 0) { |
377 | pr_err("crypto_hash_update() failed for ma challenge\n"); | 377 | pr_err("crypto_hash_update() failed for ma challenge\n"); |
@@ -414,7 +414,7 @@ static int chap_got_response( | |||
414 | char *nr_out_ptr, | 414 | char *nr_out_ptr, |
415 | unsigned int *nr_out_len) | 415 | unsigned int *nr_out_len) |
416 | { | 416 | { |
417 | struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | 417 | struct iscsi_chap *chap = conn->auth_protocol; |
418 | 418 | ||
419 | switch (chap->digest_type) { | 419 | switch (chap->digest_type) { |
420 | case CHAP_DIGEST_MD5: | 420 | case CHAP_DIGEST_MD5: |
@@ -437,7 +437,7 @@ u32 chap_main_loop( | |||
437 | int *in_len, | 437 | int *in_len, |
438 | int *out_len) | 438 | int *out_len) |
439 | { | 439 | { |
440 | struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; | 440 | struct iscsi_chap *chap = conn->auth_protocol; |
441 | 441 | ||
442 | if (!chap) { | 442 | if (!chap) { |
443 | chap = chap_server_open(conn, auth, in_text, out_text, out_len); | 443 | chap = chap_server_open(conn, auth, in_text, out_text, out_len); |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index c04d389a2ff2..3468caab47a2 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -52,8 +52,7 @@ struct iscsi_portal_group *lio_get_tpg_from_tpg_item( | |||
52 | { | 52 | { |
53 | struct se_portal_group *se_tpg = container_of(to_config_group(item), | 53 | struct se_portal_group *se_tpg = container_of(to_config_group(item), |
54 | struct se_portal_group, tpg_group); | 54 | struct se_portal_group, tpg_group); |
55 | struct iscsi_portal_group *tpg = | 55 | struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; |
56 | (struct iscsi_portal_group *)se_tpg->se_tpg_fabric_ptr; | ||
57 | int ret; | 56 | int ret; |
58 | 57 | ||
59 | if (!tpg) { | 58 | if (!tpg) { |
@@ -1221,7 +1220,7 @@ struct se_portal_group *lio_target_tiqn_addtpg( | |||
1221 | 1220 | ||
1222 | ret = core_tpg_register( | 1221 | ret = core_tpg_register( |
1223 | &lio_target_fabric_configfs->tf_ops, | 1222 | &lio_target_fabric_configfs->tf_ops, |
1224 | wwn, &tpg->tpg_se_tpg, (void *)tpg, | 1223 | wwn, &tpg->tpg_se_tpg, tpg, |
1225 | TRANSPORT_TPG_TYPE_NORMAL); | 1224 | TRANSPORT_TPG_TYPE_NORMAL); |
1226 | if (ret < 0) | 1225 | if (ret < 0) |
1227 | return NULL; | 1226 | return NULL; |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index d74e278ec8f7..373b0cc6abd8 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -143,7 +143,7 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) | |||
143 | list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list, | 143 | list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list, |
144 | sess_list) { | 144 | sess_list) { |
145 | 145 | ||
146 | sess_p = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 146 | sess_p = se_sess->fabric_sess_ptr; |
147 | spin_lock(&sess_p->conn_lock); | 147 | spin_lock(&sess_p->conn_lock); |
148 | if (atomic_read(&sess_p->session_fall_back_to_erl0) || | 148 | if (atomic_read(&sess_p->session_fall_back_to_erl0) || |
149 | atomic_read(&sess_p->session_logout) || | 149 | atomic_read(&sess_p->session_logout) || |
@@ -151,9 +151,9 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) | |||
151 | spin_unlock(&sess_p->conn_lock); | 151 | spin_unlock(&sess_p->conn_lock); |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
154 | if (!memcmp((void *)sess_p->isid, (void *)conn->sess->isid, 6) && | 154 | if (!memcmp(sess_p->isid, conn->sess->isid, 6) && |
155 | (!strcmp((void *)sess_p->sess_ops->InitiatorName, | 155 | (!strcmp(sess_p->sess_ops->InitiatorName, |
156 | (void *)initiatorname_param->value) && | 156 | initiatorname_param->value) && |
157 | (sess_p->sess_ops->SessionType == sessiontype))) { | 157 | (sess_p->sess_ops->SessionType == sessiontype))) { |
158 | atomic_set(&sess_p->session_reinstatement, 1); | 158 | atomic_set(&sess_p->session_reinstatement, 1); |
159 | spin_unlock(&sess_p->conn_lock); | 159 | spin_unlock(&sess_p->conn_lock); |
@@ -229,7 +229,7 @@ static int iscsi_login_zero_tsih_s1( | |||
229 | 229 | ||
230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); | 230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); |
231 | sess->init_task_tag = pdu->itt; | 231 | sess->init_task_tag = pdu->itt; |
232 | memcpy((void *)&sess->isid, (void *)pdu->isid, 6); | 232 | memcpy(&sess->isid, pdu->isid, 6); |
233 | sess->exp_cmd_sn = pdu->cmdsn; | 233 | sess->exp_cmd_sn = pdu->cmdsn; |
234 | INIT_LIST_HEAD(&sess->sess_conn_list); | 234 | INIT_LIST_HEAD(&sess->sess_conn_list); |
235 | INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list); | 235 | INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list); |
@@ -440,8 +440,7 @@ static int iscsi_login_non_zero_tsih_s2( | |||
440 | atomic_read(&sess_p->session_logout) || | 440 | atomic_read(&sess_p->session_logout) || |
441 | (sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED)) | 441 | (sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED)) |
442 | continue; | 442 | continue; |
443 | if (!memcmp((const void *)sess_p->isid, | 443 | if (!memcmp(sess_p->isid, pdu->isid, 6) && |
444 | (const void *)pdu->isid, 6) && | ||
445 | (sess_p->tsih == pdu->tsih)) { | 444 | (sess_p->tsih == pdu->tsih)) { |
446 | iscsit_inc_session_usage_count(sess_p); | 445 | iscsit_inc_session_usage_count(sess_p); |
447 | iscsit_stop_time2retain_timer(sess_p); | 446 | iscsit_stop_time2retain_timer(sess_p); |
@@ -654,7 +653,7 @@ static int iscsi_post_login_handler( | |||
654 | 653 | ||
655 | spin_lock_bh(&se_tpg->session_lock); | 654 | spin_lock_bh(&se_tpg->session_lock); |
656 | __transport_register_session(&sess->tpg->tpg_se_tpg, | 655 | __transport_register_session(&sess->tpg->tpg_se_tpg, |
657 | se_sess->se_node_acl, se_sess, (void *)sess); | 656 | se_sess->se_node_acl, se_sess, sess); |
658 | pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n"); | 657 | pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n"); |
659 | sess->session_state = TARG_SESS_STATE_LOGGED_IN; | 658 | sess->session_state = TARG_SESS_STATE_LOGGED_IN; |
660 | 659 | ||
@@ -811,7 +810,7 @@ int iscsi_target_setup_login_socket( | |||
811 | * Setup the np->np_sockaddr from the passed sockaddr setup | 810 | * Setup the np->np_sockaddr from the passed sockaddr setup |
812 | * in iscsi_target_configfs.c code.. | 811 | * in iscsi_target_configfs.c code.. |
813 | */ | 812 | */ |
814 | memcpy((void *)&np->np_sockaddr, (void *)sockaddr, | 813 | memcpy(&np->np_sockaddr, sockaddr, |
815 | sizeof(struct __kernel_sockaddr_storage)); | 814 | sizeof(struct __kernel_sockaddr_storage)); |
816 | 815 | ||
817 | if (sockaddr->ss_family == AF_INET6) | 816 | if (sockaddr->ss_family == AF_INET6) |
@@ -821,6 +820,7 @@ int iscsi_target_setup_login_socket( | |||
821 | /* | 820 | /* |
822 | * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. | 821 | * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. |
823 | */ | 822 | */ |
823 | /* FIXME: Someone please explain why this is endian-safe */ | ||
824 | opt = 1; | 824 | opt = 1; |
825 | if (np->np_network_transport == ISCSI_TCP) { | 825 | if (np->np_network_transport == ISCSI_TCP) { |
826 | ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, | 826 | ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, |
@@ -832,6 +832,7 @@ int iscsi_target_setup_login_socket( | |||
832 | } | 832 | } |
833 | } | 833 | } |
834 | 834 | ||
835 | /* FIXME: Someone please explain why this is endian-safe */ | ||
835 | ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, | 836 | ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, |
836 | (char *)&opt, sizeof(opt)); | 837 | (char *)&opt, sizeof(opt)); |
837 | if (ret < 0) { | 838 | if (ret < 0) { |
@@ -1206,7 +1207,7 @@ out: | |||
1206 | 1207 | ||
1207 | int iscsi_target_login_thread(void *arg) | 1208 | int iscsi_target_login_thread(void *arg) |
1208 | { | 1209 | { |
1209 | struct iscsi_np *np = (struct iscsi_np *)arg; | 1210 | struct iscsi_np *np = arg; |
1210 | int ret; | 1211 | int ret; |
1211 | 1212 | ||
1212 | allow_signal(SIGINT); | 1213 | allow_signal(SIGINT); |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 53eea5c827f0..e89fa7457254 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -732,7 +732,7 @@ static void iscsi_initiatorname_tolower( | |||
732 | u32 iqn_size = strlen(param_buf), i; | 732 | u32 iqn_size = strlen(param_buf), i; |
733 | 733 | ||
734 | for (i = 0; i < iqn_size; i++) { | 734 | for (i = 0; i < iqn_size; i++) { |
735 | c = (char *)¶m_buf[i]; | 735 | c = ¶m_buf[i]; |
736 | if (!isupper(*c)) | 736 | if (!isupper(*c)) |
737 | continue; | 737 | continue; |
738 | 738 | ||
diff --git a/drivers/target/iscsi/iscsi_target_nodeattrib.c b/drivers/target/iscsi/iscsi_target_nodeattrib.c index ac047d8a7a13..b3c699c4fe8c 100644 --- a/drivers/target/iscsi/iscsi_target_nodeattrib.c +++ b/drivers/target/iscsi/iscsi_target_nodeattrib.c | |||
@@ -134,7 +134,7 @@ extern int iscsit_na_nopin_timeout( | |||
134 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 134 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
135 | se_sess = se_nacl->nacl_sess; | 135 | se_sess = se_nacl->nacl_sess; |
136 | if (se_sess) { | 136 | if (se_sess) { |
137 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 137 | sess = se_sess->fabric_sess_ptr; |
138 | 138 | ||
139 | spin_lock(&sess->conn_lock); | 139 | spin_lock(&sess->conn_lock); |
140 | list_for_each_entry(conn, &sess->sess_conn_list, | 140 | list_for_each_entry(conn, &sess->sess_conn_list, |
diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c index 5a1aac0ec7de..421d6947dc64 100644 --- a/drivers/target/iscsi/iscsi_target_stat.c +++ b/drivers/target/iscsi/iscsi_target_stat.c | |||
@@ -745,7 +745,7 @@ static ssize_t iscsi_stat_sess_show_attr_node( | |||
745 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 745 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
746 | se_sess = se_nacl->nacl_sess; | 746 | se_sess = se_nacl->nacl_sess; |
747 | if (se_sess) { | 747 | if (se_sess) { |
748 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 748 | sess = se_sess->fabric_sess_ptr; |
749 | if (sess) | 749 | if (sess) |
750 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 750 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
751 | sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); | 751 | sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); |
@@ -769,7 +769,7 @@ static ssize_t iscsi_stat_sess_show_attr_indx( | |||
769 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 769 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
770 | se_sess = se_nacl->nacl_sess; | 770 | se_sess = se_nacl->nacl_sess; |
771 | if (se_sess) { | 771 | if (se_sess) { |
772 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 772 | sess = se_sess->fabric_sess_ptr; |
773 | if (sess) | 773 | if (sess) |
774 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 774 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
775 | sess->session_index); | 775 | sess->session_index); |
@@ -793,7 +793,7 @@ static ssize_t iscsi_stat_sess_show_attr_cmd_pdus( | |||
793 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 793 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
794 | se_sess = se_nacl->nacl_sess; | 794 | se_sess = se_nacl->nacl_sess; |
795 | if (se_sess) { | 795 | if (se_sess) { |
796 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 796 | sess = se_sess->fabric_sess_ptr; |
797 | if (sess) | 797 | if (sess) |
798 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); | 798 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); |
799 | } | 799 | } |
@@ -816,7 +816,7 @@ static ssize_t iscsi_stat_sess_show_attr_rsp_pdus( | |||
816 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 816 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
817 | se_sess = se_nacl->nacl_sess; | 817 | se_sess = se_nacl->nacl_sess; |
818 | if (se_sess) { | 818 | if (se_sess) { |
819 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 819 | sess = se_sess->fabric_sess_ptr; |
820 | if (sess) | 820 | if (sess) |
821 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); | 821 | ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); |
822 | } | 822 | } |
@@ -839,7 +839,7 @@ static ssize_t iscsi_stat_sess_show_attr_txdata_octs( | |||
839 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 839 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
840 | se_sess = se_nacl->nacl_sess; | 840 | se_sess = se_nacl->nacl_sess; |
841 | if (se_sess) { | 841 | if (se_sess) { |
842 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 842 | sess = se_sess->fabric_sess_ptr; |
843 | if (sess) | 843 | if (sess) |
844 | ret = snprintf(page, PAGE_SIZE, "%llu\n", | 844 | ret = snprintf(page, PAGE_SIZE, "%llu\n", |
845 | (unsigned long long)sess->tx_data_octets); | 845 | (unsigned long long)sess->tx_data_octets); |
@@ -863,7 +863,7 @@ static ssize_t iscsi_stat_sess_show_attr_rxdata_octs( | |||
863 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 863 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
864 | se_sess = se_nacl->nacl_sess; | 864 | se_sess = se_nacl->nacl_sess; |
865 | if (se_sess) { | 865 | if (se_sess) { |
866 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 866 | sess = se_sess->fabric_sess_ptr; |
867 | if (sess) | 867 | if (sess) |
868 | ret = snprintf(page, PAGE_SIZE, "%llu\n", | 868 | ret = snprintf(page, PAGE_SIZE, "%llu\n", |
869 | (unsigned long long)sess->rx_data_octets); | 869 | (unsigned long long)sess->rx_data_octets); |
@@ -887,7 +887,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors( | |||
887 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 887 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
888 | se_sess = se_nacl->nacl_sess; | 888 | se_sess = se_nacl->nacl_sess; |
889 | if (se_sess) { | 889 | if (se_sess) { |
890 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 890 | sess = se_sess->fabric_sess_ptr; |
891 | if (sess) | 891 | if (sess) |
892 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 892 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
893 | sess->conn_digest_errors); | 893 | sess->conn_digest_errors); |
@@ -911,7 +911,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors( | |||
911 | spin_lock_bh(&se_nacl->nacl_sess_lock); | 911 | spin_lock_bh(&se_nacl->nacl_sess_lock); |
912 | se_sess = se_nacl->nacl_sess; | 912 | se_sess = se_nacl->nacl_sess; |
913 | if (se_sess) { | 913 | if (se_sess) { |
914 | sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; | 914 | sess = se_sess->fabric_sess_ptr; |
915 | if (sess) | 915 | if (sess) |
916 | ret = snprintf(page, PAGE_SIZE, "%u\n", | 916 | ret = snprintf(page, PAGE_SIZE, "%u\n", |
917 | sess->conn_timeout_errors); | 917 | sess->conn_timeout_errors); |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index cfbcf6e4877d..879d8d0fa3fe 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -70,7 +70,7 @@ int iscsit_load_discovery_tpg(void) | |||
70 | 70 | ||
71 | ret = core_tpg_register( | 71 | ret = core_tpg_register( |
72 | &lio_target_fabric_configfs->tf_ops, | 72 | &lio_target_fabric_configfs->tf_ops, |
73 | NULL, &tpg->tpg_se_tpg, (void *)tpg, | 73 | NULL, &tpg->tpg_se_tpg, tpg, |
74 | TRANSPORT_TPG_TYPE_DISCOVERY); | 74 | TRANSPORT_TPG_TYPE_DISCOVERY); |
75 | if (ret < 0) { | 75 | if (ret < 0) { |
76 | kfree(tpg); | 76 | kfree(tpg); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index c1daea190859..a05ca1c4f01c 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -287,7 +287,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr( | |||
287 | } | 287 | } |
288 | 288 | ||
289 | se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, | 289 | se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, |
290 | (void *)cmd->tmr_req, tcm_function, | 290 | cmd->tmr_req, tcm_function, |
291 | GFP_KERNEL); | 291 | GFP_KERNEL); |
292 | if (!se_cmd->se_tmr_req) | 292 | if (!se_cmd->se_tmr_req) |
293 | goto out; | 293 | goto out; |
@@ -1064,7 +1064,7 @@ static void iscsit_handle_nopin_response_timeout(unsigned long data) | |||
1064 | if (tiqn) { | 1064 | if (tiqn) { |
1065 | spin_lock_bh(&tiqn->sess_err_stats.lock); | 1065 | spin_lock_bh(&tiqn->sess_err_stats.lock); |
1066 | strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name, | 1066 | strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name, |
1067 | (void *)conn->sess->sess_ops->InitiatorName); | 1067 | conn->sess->sess_ops->InitiatorName); |
1068 | tiqn->sess_err_stats.last_sess_failure_type = | 1068 | tiqn->sess_err_stats.last_sess_failure_type = |
1069 | ISCSI_SESS_ERR_CXN_TIMEOUT; | 1069 | ISCSI_SESS_ERR_CXN_TIMEOUT; |
1070 | tiqn->sess_err_stats.cxn_timeout_errors++; | 1070 | tiqn->sess_err_stats.cxn_timeout_errors++; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index d427a290e184..572d27a6b7ae 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -559,8 +559,7 @@ static char *tcm_loop_get_fabric_name(void) | |||
559 | 559 | ||
560 | static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) | 560 | static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) |
561 | { | 561 | { |
562 | struct tcm_loop_tpg *tl_tpg = | 562 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
563 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
564 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 563 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
565 | /* | 564 | /* |
566 | * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba() | 565 | * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba() |
@@ -587,8 +586,7 @@ static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) | |||
587 | 586 | ||
588 | static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) | 587 | static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) |
589 | { | 588 | { |
590 | struct tcm_loop_tpg *tl_tpg = | 589 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
591 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
592 | /* | 590 | /* |
593 | * Return the passed NAA identifier for the SAS Target Port | 591 | * Return the passed NAA identifier for the SAS Target Port |
594 | */ | 592 | */ |
@@ -597,8 +595,7 @@ static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) | |||
597 | 595 | ||
598 | static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) | 596 | static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) |
599 | { | 597 | { |
600 | struct tcm_loop_tpg *tl_tpg = | 598 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
601 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
602 | /* | 599 | /* |
603 | * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 | 600 | * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 |
604 | * to represent the SCSI Target Port. | 601 | * to represent the SCSI Target Port. |
@@ -618,8 +615,7 @@ static u32 tcm_loop_get_pr_transport_id( | |||
618 | int *format_code, | 615 | int *format_code, |
619 | unsigned char *buf) | 616 | unsigned char *buf) |
620 | { | 617 | { |
621 | struct tcm_loop_tpg *tl_tpg = | 618 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
622 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
623 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 619 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
624 | 620 | ||
625 | switch (tl_hba->tl_proto_id) { | 621 | switch (tl_hba->tl_proto_id) { |
@@ -648,8 +644,7 @@ static u32 tcm_loop_get_pr_transport_id_len( | |||
648 | struct t10_pr_registration *pr_reg, | 644 | struct t10_pr_registration *pr_reg, |
649 | int *format_code) | 645 | int *format_code) |
650 | { | 646 | { |
651 | struct tcm_loop_tpg *tl_tpg = | 647 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
652 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
653 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 648 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
654 | 649 | ||
655 | switch (tl_hba->tl_proto_id) { | 650 | switch (tl_hba->tl_proto_id) { |
@@ -682,8 +677,7 @@ static char *tcm_loop_parse_pr_out_transport_id( | |||
682 | u32 *out_tid_len, | 677 | u32 *out_tid_len, |
683 | char **port_nexus_ptr) | 678 | char **port_nexus_ptr) |
684 | { | 679 | { |
685 | struct tcm_loop_tpg *tl_tpg = | 680 | struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr; |
686 | (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; | ||
687 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 681 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
688 | 682 | ||
689 | switch (tl_hba->tl_proto_id) { | 683 | switch (tl_hba->tl_proto_id) { |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 59219509d886..5c60d0a97a50 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -116,11 +116,9 @@ target_emulate_inquiry_std(struct se_cmd *cmd) | |||
116 | goto out; | 116 | goto out; |
117 | } | 117 | } |
118 | 118 | ||
119 | snprintf((unsigned char *)&buf[8], 8, "LIO-ORG"); | 119 | snprintf(&buf[8], 8, "LIO-ORG"); |
120 | snprintf((unsigned char *)&buf[16], 16, "%s", | 120 | snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model); |
121 | &dev->se_sub_dev->t10_wwn.model[0]); | 121 | snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision); |
122 | snprintf((unsigned char *)&buf[32], 4, "%s", | ||
123 | &dev->se_sub_dev->t10_wwn.revision[0]); | ||
124 | buf[4] = 31; /* Set additional length to 31 */ | 122 | buf[4] = 31; /* Set additional length to 31 */ |
125 | 123 | ||
126 | out: | 124 | out: |
@@ -139,8 +137,7 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) | |||
139 | SDF_EMULATED_VPD_UNIT_SERIAL) { | 137 | SDF_EMULATED_VPD_UNIT_SERIAL) { |
140 | u32 unit_serial_len; | 138 | u32 unit_serial_len; |
141 | 139 | ||
142 | unit_serial_len = | 140 | unit_serial_len = strlen(dev->se_sub_dev->t10_wwn.unit_serial); |
143 | strlen(&dev->se_sub_dev->t10_wwn.unit_serial[0]); | ||
144 | unit_serial_len++; /* For NULL Terminator */ | 141 | unit_serial_len++; /* For NULL Terminator */ |
145 | 142 | ||
146 | if (((len + 4) + unit_serial_len) > cmd->data_length) { | 143 | if (((len + 4) + unit_serial_len) > cmd->data_length) { |
@@ -149,8 +146,8 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) | |||
149 | buf[3] = (len & 0xff); | 146 | buf[3] = (len & 0xff); |
150 | return 0; | 147 | return 0; |
151 | } | 148 | } |
152 | len += sprintf((unsigned char *)&buf[4], "%s", | 149 | len += sprintf(&buf[4], "%s", |
153 | &dev->se_sub_dev->t10_wwn.unit_serial[0]); | 150 | dev->se_sub_dev->t10_wwn.unit_serial); |
154 | len++; /* Extra Byte for NULL Terminator */ | 151 | len++; /* Extra Byte for NULL Terminator */ |
155 | buf[3] = len; | 152 | buf[3] = len; |
156 | } | 153 | } |
@@ -280,14 +277,13 @@ check_t10_vend_desc: | |||
280 | len += (prod_len + unit_serial_len); | 277 | len += (prod_len + unit_serial_len); |
281 | goto check_port; | 278 | goto check_port; |
282 | } | 279 | } |
283 | id_len += sprintf((unsigned char *)&buf[off+12], | 280 | id_len += sprintf(&buf[off+12], "%s:%s", prod, |
284 | "%s:%s", prod, | ||
285 | &dev->se_sub_dev->t10_wwn.unit_serial[0]); | 281 | &dev->se_sub_dev->t10_wwn.unit_serial[0]); |
286 | } | 282 | } |
287 | buf[off] = 0x2; /* ASCII */ | 283 | buf[off] = 0x2; /* ASCII */ |
288 | buf[off+1] = 0x1; /* T10 Vendor ID */ | 284 | buf[off+1] = 0x1; /* T10 Vendor ID */ |
289 | buf[off+2] = 0x0; | 285 | buf[off+2] = 0x0; |
290 | memcpy((unsigned char *)&buf[off+4], "LIO-ORG", 8); | 286 | memcpy(&buf[off+4], "LIO-ORG", 8); |
291 | /* Extra Byte for NULL Terminator */ | 287 | /* Extra Byte for NULL Terminator */ |
292 | id_len++; | 288 | id_len++; |
293 | /* Identifier Length */ | 289 | /* Identifier Length */ |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 37b2b3d03c65..eb62371611f6 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -1629,7 +1629,7 @@ static struct config_item_type target_core_dev_pr_cit = { | |||
1629 | 1629 | ||
1630 | static ssize_t target_core_show_dev_info(void *p, char *page) | 1630 | static ssize_t target_core_show_dev_info(void *p, char *page) |
1631 | { | 1631 | { |
1632 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1632 | struct se_subsystem_dev *se_dev = p; |
1633 | struct se_hba *hba = se_dev->se_dev_hba; | 1633 | struct se_hba *hba = se_dev->se_dev_hba; |
1634 | struct se_subsystem_api *t = hba->transport; | 1634 | struct se_subsystem_api *t = hba->transport; |
1635 | int bl = 0; | 1635 | int bl = 0; |
@@ -1657,7 +1657,7 @@ static ssize_t target_core_store_dev_control( | |||
1657 | const char *page, | 1657 | const char *page, |
1658 | size_t count) | 1658 | size_t count) |
1659 | { | 1659 | { |
1660 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1660 | struct se_subsystem_dev *se_dev = p; |
1661 | struct se_hba *hba = se_dev->se_dev_hba; | 1661 | struct se_hba *hba = se_dev->se_dev_hba; |
1662 | struct se_subsystem_api *t = hba->transport; | 1662 | struct se_subsystem_api *t = hba->transport; |
1663 | 1663 | ||
@@ -1680,7 +1680,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_control = { | |||
1680 | 1680 | ||
1681 | static ssize_t target_core_show_dev_alias(void *p, char *page) | 1681 | static ssize_t target_core_show_dev_alias(void *p, char *page) |
1682 | { | 1682 | { |
1683 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1683 | struct se_subsystem_dev *se_dev = p; |
1684 | 1684 | ||
1685 | if (!(se_dev->su_dev_flags & SDF_USING_ALIAS)) | 1685 | if (!(se_dev->su_dev_flags & SDF_USING_ALIAS)) |
1686 | return 0; | 1686 | return 0; |
@@ -1693,7 +1693,7 @@ static ssize_t target_core_store_dev_alias( | |||
1693 | const char *page, | 1693 | const char *page, |
1694 | size_t count) | 1694 | size_t count) |
1695 | { | 1695 | { |
1696 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1696 | struct se_subsystem_dev *se_dev = p; |
1697 | struct se_hba *hba = se_dev->se_dev_hba; | 1697 | struct se_hba *hba = se_dev->se_dev_hba; |
1698 | ssize_t read_bytes; | 1698 | ssize_t read_bytes; |
1699 | 1699 | ||
@@ -1726,7 +1726,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_alias = { | |||
1726 | 1726 | ||
1727 | static ssize_t target_core_show_dev_udev_path(void *p, char *page) | 1727 | static ssize_t target_core_show_dev_udev_path(void *p, char *page) |
1728 | { | 1728 | { |
1729 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1729 | struct se_subsystem_dev *se_dev = p; |
1730 | 1730 | ||
1731 | if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) | 1731 | if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) |
1732 | return 0; | 1732 | return 0; |
@@ -1739,7 +1739,7 @@ static ssize_t target_core_store_dev_udev_path( | |||
1739 | const char *page, | 1739 | const char *page, |
1740 | size_t count) | 1740 | size_t count) |
1741 | { | 1741 | { |
1742 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1742 | struct se_subsystem_dev *se_dev = p; |
1743 | struct se_hba *hba = se_dev->se_dev_hba; | 1743 | struct se_hba *hba = se_dev->se_dev_hba; |
1744 | ssize_t read_bytes; | 1744 | ssize_t read_bytes; |
1745 | 1745 | ||
@@ -1775,7 +1775,7 @@ static ssize_t target_core_store_dev_enable( | |||
1775 | const char *page, | 1775 | const char *page, |
1776 | size_t count) | 1776 | size_t count) |
1777 | { | 1777 | { |
1778 | struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; | 1778 | struct se_subsystem_dev *se_dev = p; |
1779 | struct se_device *dev; | 1779 | struct se_device *dev; |
1780 | struct se_hba *hba = se_dev->se_dev_hba; | 1780 | struct se_hba *hba = se_dev->se_dev_hba; |
1781 | struct se_subsystem_api *t = hba->transport; | 1781 | struct se_subsystem_api *t = hba->transport; |
@@ -1820,7 +1820,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_enable = { | |||
1820 | static ssize_t target_core_show_alua_lu_gp(void *p, char *page) | 1820 | static ssize_t target_core_show_alua_lu_gp(void *p, char *page) |
1821 | { | 1821 | { |
1822 | struct se_device *dev; | 1822 | struct se_device *dev; |
1823 | struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; | 1823 | struct se_subsystem_dev *su_dev = p; |
1824 | struct config_item *lu_ci; | 1824 | struct config_item *lu_ci; |
1825 | struct t10_alua_lu_gp *lu_gp; | 1825 | struct t10_alua_lu_gp *lu_gp; |
1826 | struct t10_alua_lu_gp_member *lu_gp_mem; | 1826 | struct t10_alua_lu_gp_member *lu_gp_mem; |
@@ -1858,7 +1858,7 @@ static ssize_t target_core_store_alua_lu_gp( | |||
1858 | size_t count) | 1858 | size_t count) |
1859 | { | 1859 | { |
1860 | struct se_device *dev; | 1860 | struct se_device *dev; |
1861 | struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; | 1861 | struct se_subsystem_dev *su_dev = p; |
1862 | struct se_hba *hba = su_dev->se_dev_hba; | 1862 | struct se_hba *hba = su_dev->se_dev_hba; |
1863 | struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; | 1863 | struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; |
1864 | struct t10_alua_lu_gp_member *lu_gp_mem; | 1864 | struct t10_alua_lu_gp_member *lu_gp_mem; |
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c index 32d7feb405ec..283a36e464e6 100644 --- a/drivers/target/target_core_fabric_lib.c +++ b/drivers/target/target_core_fabric_lib.c | |||
@@ -399,7 +399,7 @@ char *iscsi_parse_pr_out_transport_id( | |||
399 | add_len = ((buf[2] >> 8) & 0xff); | 399 | add_len = ((buf[2] >> 8) & 0xff); |
400 | add_len |= (buf[3] & 0xff); | 400 | add_len |= (buf[3] & 0xff); |
401 | 401 | ||
402 | tid_len = strlen((char *)&buf[4]); | 402 | tid_len = strlen(&buf[4]); |
403 | tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ | 403 | tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ |
404 | tid_len += 1; /* Add one byte for NULL terminator */ | 404 | tid_len += 1; /* Add one byte for NULL terminator */ |
405 | padding = ((-tid_len) & 3); | 405 | padding = ((-tid_len) & 3); |
@@ -420,11 +420,11 @@ char *iscsi_parse_pr_out_transport_id( | |||
420 | * format. | 420 | * format. |
421 | */ | 421 | */ |
422 | if (format_code == 0x40) { | 422 | if (format_code == 0x40) { |
423 | p = strstr((char *)&buf[4], ",i,0x"); | 423 | p = strstr(&buf[4], ",i,0x"); |
424 | if (!p) { | 424 | if (!p) { |
425 | pr_err("Unable to locate \",i,0x\" seperator" | 425 | pr_err("Unable to locate \",i,0x\" seperator" |
426 | " for Initiator port identifier: %s\n", | 426 | " for Initiator port identifier: %s\n", |
427 | (char *)&buf[4]); | 427 | &buf[4]); |
428 | return NULL; | 428 | return NULL; |
429 | } | 429 | } |
430 | *p = '\0'; /* Terminate iSCSI Name */ | 430 | *p = '\0'; /* Terminate iSCSI Name */ |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 91bf11a0ab16..7ed58e2df791 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -85,7 +85,7 @@ static void fd_detach_hba(struct se_hba *hba) | |||
85 | static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name) | 85 | static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name) |
86 | { | 86 | { |
87 | struct fd_dev *fd_dev; | 87 | struct fd_dev *fd_dev; |
88 | struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; | 88 | struct fd_host *fd_host = hba->hba_ptr; |
89 | 89 | ||
90 | fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL); | 90 | fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL); |
91 | if (!fd_dev) { | 91 | if (!fd_dev) { |
@@ -113,8 +113,8 @@ static struct se_device *fd_create_virtdevice( | |||
113 | struct se_device *dev; | 113 | struct se_device *dev; |
114 | struct se_dev_limits dev_limits; | 114 | struct se_dev_limits dev_limits; |
115 | struct queue_limits *limits; | 115 | struct queue_limits *limits; |
116 | struct fd_dev *fd_dev = (struct fd_dev *) p; | 116 | struct fd_dev *fd_dev = p; |
117 | struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; | 117 | struct fd_host *fd_host = hba->hba_ptr; |
118 | mm_segment_t old_fs; | 118 | mm_segment_t old_fs; |
119 | struct file *file; | 119 | struct file *file; |
120 | struct inode *inode = NULL; | 120 | struct inode *inode = NULL; |
@@ -239,7 +239,7 @@ fail: | |||
239 | */ | 239 | */ |
240 | static void fd_free_device(void *p) | 240 | static void fd_free_device(void *p) |
241 | { | 241 | { |
242 | struct fd_dev *fd_dev = (struct fd_dev *) p; | 242 | struct fd_dev *fd_dev = p; |
243 | 243 | ||
244 | if (fd_dev->fd_file) { | 244 | if (fd_dev->fd_file) { |
245 | filp_close(fd_dev->fd_file, NULL); | 245 | filp_close(fd_dev->fd_file, NULL); |
@@ -558,7 +558,7 @@ out: | |||
558 | 558 | ||
559 | static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev) | 559 | static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev) |
560 | { | 560 | { |
561 | struct fd_dev *fd_dev = (struct fd_dev *) se_dev->se_dev_su_ptr; | 561 | struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; |
562 | 562 | ||
563 | if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) { | 563 | if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) { |
564 | pr_err("Missing fd_dev_name=\n"); | 564 | pr_err("Missing fd_dev_name=\n"); |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 3c1a7aa658a2..cc8e6b58ef20 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -464,7 +464,7 @@ static ssize_t iblock_show_configfs_dev_params( | |||
464 | if (bd) { | 464 | if (bd) { |
465 | bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", | 465 | bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", |
466 | MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? | 466 | MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? |
467 | "" : (bd->bd_holder == (struct iblock_dev *)ibd) ? | 467 | "" : (bd->bd_holder == ibd) ? |
468 | "CLAIMED: IBLOCK" : "CLAIMED: OS"); | 468 | "CLAIMED: IBLOCK" : "CLAIMED: OS"); |
469 | } else { | 469 | } else { |
470 | bl += sprintf(b + bl, "Major: 0 Minor: 0\n"); | 470 | bl += sprintf(b + bl, "Major: 0 Minor: 0\n"); |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index bb44ed4d0272..b73a399cdd54 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -104,7 +104,7 @@ static void pscsi_detach_hba(struct se_hba *hba) | |||
104 | 104 | ||
105 | static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) | 105 | static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) |
106 | { | 106 | { |
107 | struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; | 107 | struct pscsi_hba_virt *phv = hba->hba_ptr; |
108 | struct Scsi_Host *sh = phv->phv_lld_host; | 108 | struct Scsi_Host *sh = phv->phv_lld_host; |
109 | /* | 109 | /* |
110 | * Release the struct Scsi_Host | 110 | * Release the struct Scsi_Host |
@@ -405,7 +405,7 @@ static struct se_device *pscsi_create_type_disk( | |||
405 | __releases(sh->host_lock) | 405 | __releases(sh->host_lock) |
406 | { | 406 | { |
407 | struct se_device *dev; | 407 | struct se_device *dev; |
408 | struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | 408 | struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; |
409 | struct Scsi_Host *sh = sd->host; | 409 | struct Scsi_Host *sh = sd->host; |
410 | struct block_device *bd; | 410 | struct block_device *bd; |
411 | u32 dev_flags = 0; | 411 | u32 dev_flags = 0; |
@@ -453,7 +453,7 @@ static struct se_device *pscsi_create_type_rom( | |||
453 | __releases(sh->host_lock) | 453 | __releases(sh->host_lock) |
454 | { | 454 | { |
455 | struct se_device *dev; | 455 | struct se_device *dev; |
456 | struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | 456 | struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; |
457 | struct Scsi_Host *sh = sd->host; | 457 | struct Scsi_Host *sh = sd->host; |
458 | u32 dev_flags = 0; | 458 | u32 dev_flags = 0; |
459 | 459 | ||
@@ -488,7 +488,7 @@ static struct se_device *pscsi_create_type_other( | |||
488 | __releases(sh->host_lock) | 488 | __releases(sh->host_lock) |
489 | { | 489 | { |
490 | struct se_device *dev; | 490 | struct se_device *dev; |
491 | struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; | 491 | struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr; |
492 | struct Scsi_Host *sh = sd->host; | 492 | struct Scsi_Host *sh = sd->host; |
493 | u32 dev_flags = 0; | 493 | u32 dev_flags = 0; |
494 | 494 | ||
@@ -509,10 +509,10 @@ static struct se_device *pscsi_create_virtdevice( | |||
509 | struct se_subsystem_dev *se_dev, | 509 | struct se_subsystem_dev *se_dev, |
510 | void *p) | 510 | void *p) |
511 | { | 511 | { |
512 | struct pscsi_dev_virt *pdv = (struct pscsi_dev_virt *)p; | 512 | struct pscsi_dev_virt *pdv = p; |
513 | struct se_device *dev; | 513 | struct se_device *dev; |
514 | struct scsi_device *sd; | 514 | struct scsi_device *sd; |
515 | struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; | 515 | struct pscsi_hba_virt *phv = hba->hba_ptr; |
516 | struct Scsi_Host *sh = phv->phv_lld_host; | 516 | struct Scsi_Host *sh = phv->phv_lld_host; |
517 | int legacy_mode_enable = 0; | 517 | int legacy_mode_enable = 0; |
518 | 518 | ||
@@ -1143,7 +1143,7 @@ static unsigned char *pscsi_get_sense_buffer(struct se_task *task) | |||
1143 | { | 1143 | { |
1144 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); | 1144 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); |
1145 | 1145 | ||
1146 | return (unsigned char *)&pt->pscsi_sense[0]; | 1146 | return pt->pscsi_sense; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | /* pscsi_get_device_rev(): | 1149 | /* pscsi_get_device_rev(): |
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index 6d8a90464f2e..f8c2d2cc3431 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c | |||
@@ -1755,8 +1755,7 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( | |||
1755 | /* scsiAttIntrPortName+scsiAttIntrPortIdentifier */ | 1755 | /* scsiAttIntrPortName+scsiAttIntrPortIdentifier */ |
1756 | memset(buf, 0, 64); | 1756 | memset(buf, 0, 64); |
1757 | if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) | 1757 | if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) |
1758 | tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, | 1758 | tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, buf, 64); |
1759 | (unsigned char *)&buf[0], 64); | ||
1760 | 1759 | ||
1761 | ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf); | 1760 | ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf); |
1762 | spin_unlock_irq(&nacl->nacl_sess_lock); | 1761 | spin_unlock_irq(&nacl->nacl_sess_lock); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 511836eb2953..122925686de2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -4161,7 +4161,7 @@ check_cond: | |||
4161 | 4161 | ||
4162 | static int transport_clear_lun_thread(void *p) | 4162 | static int transport_clear_lun_thread(void *p) |
4163 | { | 4163 | { |
4164 | struct se_lun *lun = (struct se_lun *)p; | 4164 | struct se_lun *lun = p; |
4165 | 4165 | ||
4166 | __transport_clear_lun_from_sessions(lun); | 4166 | __transport_clear_lun_from_sessions(lun); |
4167 | complete(&lun->lun_shutdown_comp); | 4167 | complete(&lun->lun_shutdown_comp); |
@@ -4580,7 +4580,7 @@ static int transport_processing_thread(void *param) | |||
4580 | { | 4580 | { |
4581 | int ret; | 4581 | int ret; |
4582 | struct se_cmd *cmd; | 4582 | struct se_cmd *cmd; |
4583 | struct se_device *dev = (struct se_device *) param; | 4583 | struct se_device *dev = param; |
4584 | 4584 | ||
4585 | while (!kthread_should_stop()) { | 4585 | while (!kthread_should_stop()) { |
4586 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, | 4586 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, |