Commit 7d0dba17 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[SCSI] qla2xxx: Restrict model-name/description device-table usage.

Information present in static table is only valid for pre-ISP25xx
adapters.
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent fc3ea9bc
...@@ -1538,6 +1538,7 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len, ...@@ -1538,6 +1538,7 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,
char *st, *en; char *st, *en;
uint16_t index; uint16_t index;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int use_tbl = !IS_QLA25XX(ha) && IS_QLA81XX(ha);
if (memcmp(model, BINZERO, len) != 0) { if (memcmp(model, BINZERO, len) != 0) {
strncpy(ha->model_number, model, len); strncpy(ha->model_number, model, len);
...@@ -1550,14 +1551,16 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len, ...@@ -1550,14 +1551,16 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,
} }
index = (ha->pdev->subsystem_device & 0xff); index = (ha->pdev->subsystem_device & 0xff);
if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && if (use_tbl &&
ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
index < QLA_MODEL_NAMES) index < QLA_MODEL_NAMES)
strncpy(ha->model_desc, strncpy(ha->model_desc,
qla2x00_model_name[index * 2 + 1], qla2x00_model_name[index * 2 + 1],
sizeof(ha->model_desc) - 1); sizeof(ha->model_desc) - 1);
} else { } else {
index = (ha->pdev->subsystem_device & 0xff); index = (ha->pdev->subsystem_device & 0xff);
if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && if (use_tbl &&
ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
index < QLA_MODEL_NAMES) { index < QLA_MODEL_NAMES) {
strcpy(ha->model_number, strcpy(ha->model_number,
qla2x00_model_name[index * 2]); qla2x00_model_name[index * 2]);
......
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