mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
qla2x00t-32gbit: Use memcpy(), strlcpy() and snprintf() instead of strncpy()
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8389 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4405,7 +4405,7 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,
|
||||
if (len > sizeof(zero))
|
||||
len = sizeof(zero);
|
||||
if (memcmp(model, &zero, len) != 0) {
|
||||
strncpy(ha->model_number, model, len);
|
||||
memcpy(ha->model_number, model, len);
|
||||
st = en = ha->model_number;
|
||||
en += len - 1;
|
||||
while (en > st) {
|
||||
@@ -4418,19 +4418,20 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,
|
||||
if (use_tbl &&
|
||||
ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
|
||||
index < QLA_MODEL_NAMES)
|
||||
strncpy(ha->model_desc,
|
||||
strlcpy(ha->model_desc,
|
||||
qla2x00_model_name[index * 2 + 1],
|
||||
sizeof(ha->model_desc) - 1);
|
||||
sizeof(ha->model_desc));
|
||||
} else {
|
||||
index = (ha->pdev->subsystem_device & 0xff);
|
||||
if (use_tbl &&
|
||||
ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
|
||||
index < QLA_MODEL_NAMES) {
|
||||
strcpy(ha->model_number,
|
||||
qla2x00_model_name[index * 2]);
|
||||
strncpy(ha->model_desc,
|
||||
strlcpy(ha->model_number,
|
||||
qla2x00_model_name[index * 2],
|
||||
sizeof(ha->model_number));
|
||||
strlcpy(ha->model_desc,
|
||||
qla2x00_model_name[index * 2 + 1],
|
||||
sizeof(ha->model_desc) - 1);
|
||||
sizeof(ha->model_desc));
|
||||
} else {
|
||||
strlcpy(ha->model_number, def,
|
||||
sizeof(ha->model_number));
|
||||
|
||||
@@ -1949,8 +1949,10 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
|
||||
if (fx_type == FXDISC_GET_CONFIG_INFO) {
|
||||
struct config_info_data *pinfo =
|
||||
(struct config_info_data *) fdisc->u.fxiocb.rsp_addr;
|
||||
strcpy(vha->hw->model_number, pinfo->model_num);
|
||||
strcpy(vha->hw->model_desc, pinfo->model_description);
|
||||
strlcpy(vha->hw->model_number, pinfo->model_num,
|
||||
ARRAY_SIZE(vha->hw->model_number));
|
||||
strlcpy(vha->hw->model_desc, pinfo->model_description,
|
||||
ARRAY_SIZE(vha->hw->model_desc));
|
||||
memcpy(&vha->hw->mr.symbolic_name, pinfo->symbolic_name,
|
||||
sizeof(vha->hw->mr.symbolic_name));
|
||||
memcpy(&vha->hw->mr.serial_num, pinfo->serial_num,
|
||||
|
||||
Reference in New Issue
Block a user