Commit bdbb9662 authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Christoph Hellwig

scsi: qla4xxx: ql4_os.c: Cleaning up missing null-terminate in conjunction with strncpy

Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-By: default avatarNilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent e88285d6
...@@ -756,9 +756,9 @@ static int qla4xxx_get_chap_list(struct Scsi_Host *shost, uint16_t chap_tbl_idx, ...@@ -756,9 +756,9 @@ static int qla4xxx_get_chap_list(struct Scsi_Host *shost, uint16_t chap_tbl_idx,
continue; continue;
chap_rec->chap_tbl_idx = i; chap_rec->chap_tbl_idx = i;
strncpy(chap_rec->username, chap_table->name, strlcpy(chap_rec->username, chap_table->name,
ISCSI_CHAP_AUTH_NAME_MAX_LEN); ISCSI_CHAP_AUTH_NAME_MAX_LEN);
strncpy(chap_rec->password, chap_table->secret, strlcpy(chap_rec->password, chap_table->secret,
QL4_CHAP_MAX_SECRET_LEN); QL4_CHAP_MAX_SECRET_LEN);
chap_rec->password_length = chap_table->secret_len; chap_rec->password_length = chap_table->secret_len;
...@@ -6027,8 +6027,8 @@ static int qla4xxx_get_bidi_chap(struct scsi_qla_host *ha, char *username, ...@@ -6027,8 +6027,8 @@ static int qla4xxx_get_bidi_chap(struct scsi_qla_host *ha, char *username,
if (!(chap_table->flags & BIT_6)) /* Not BIDI */ if (!(chap_table->flags & BIT_6)) /* Not BIDI */
continue; continue;
strncpy(password, chap_table->secret, QL4_CHAP_MAX_SECRET_LEN); strlcpy(password, chap_table->secret, QL4_CHAP_MAX_SECRET_LEN);
strncpy(username, chap_table->name, QL4_CHAP_MAX_NAME_LEN); strlcpy(username, chap_table->name, QL4_CHAP_MAX_NAME_LEN);
ret = 0; ret = 0;
break; break;
} }
...@@ -6258,8 +6258,8 @@ static void qla4xxx_get_param_ddb(struct ddb_entry *ddb_entry, ...@@ -6258,8 +6258,8 @@ static void qla4xxx_get_param_ddb(struct ddb_entry *ddb_entry,
tddb->tpgt = sess->tpgt; tddb->tpgt = sess->tpgt;
tddb->port = conn->persistent_port; tddb->port = conn->persistent_port;
strncpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE); strlcpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE);
strncpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN); strlcpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN);
} }
static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry, static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry,
...@@ -7764,7 +7764,7 @@ static int qla4xxx_sysfs_ddb_logout(struct iscsi_bus_flash_session *fnode_sess, ...@@ -7764,7 +7764,7 @@ static int qla4xxx_sysfs_ddb_logout(struct iscsi_bus_flash_session *fnode_sess,
goto exit_ddb_logout; goto exit_ddb_logout;
} }
strncpy(flash_tddb->iscsi_name, fnode_sess->targetname, strlcpy(flash_tddb->iscsi_name, fnode_sess->targetname,
ISCSI_NAME_SIZE); ISCSI_NAME_SIZE);
if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4)) if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment