Commit 383a298b authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Martin K. Petersen

scsi: qla2xxx: Retain loop test for fwdump length exceeding buffer length

Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: default avatarBart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8b631d87
...@@ -6356,8 +6356,8 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -6356,8 +6356,8 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
"-> template size %x bytes\n", dlen); "-> template size %x bytes\n", dlen);
if (dlen > risc_size * sizeof(*dcode)) { if (dlen > risc_size * sizeof(*dcode)) {
ql_log(ql_log_warn, vha, 0x0167, ql_log(ql_log_warn, vha, 0x0167,
"Failed fwdump template exceeds array by %x bytes\n", "Failed fwdump template exceeds array by %lx bytes\n",
(uint32_t)(dlen - risc_size * sizeof(*dcode))); (size_t)(dlen - risc_size * sizeof(*dcode)));
goto default_template; goto default_template;
} }
ha->fw_dump_template_len = dlen; ha->fw_dump_template_len = dlen;
...@@ -6658,8 +6658,8 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr) ...@@ -6658,8 +6658,8 @@ qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
"-> template size %x bytes\n", dlen); "-> template size %x bytes\n", dlen);
if (dlen > risc_size * sizeof(*fwcode)) { if (dlen > risc_size * sizeof(*fwcode)) {
ql_log(ql_log_warn, vha, 0x0177, ql_log(ql_log_warn, vha, 0x0177,
"Failed fwdump template exceeds array by %x bytes\n", "Failed fwdump template exceeds array by %lx bytes\n",
(uint32_t)(dlen - risc_size * sizeof(*fwcode))); (size_t)(dlen - risc_size * sizeof(*fwcode)));
goto default_template; goto default_template;
} }
ha->fw_dump_template_len = dlen; ha->fw_dump_template_len = dlen;
......
...@@ -219,8 +219,6 @@ qla27xx_skip_entry(struct qla27xx_fwdt_entry *ent, void *buf) ...@@ -219,8 +219,6 @@ qla27xx_skip_entry(struct qla27xx_fwdt_entry *ent, void *buf)
{ {
if (buf) if (buf)
ent->hdr.driver_flags |= DRIVER_FLAG_SKIP_ENTRY; ent->hdr.driver_flags |= DRIVER_FLAG_SKIP_ENTRY;
ql_dbg(ql_dbg_misc + ql_dbg_verbose, NULL, 0xd011,
"Skipping entry %d\n", ent->hdr.entry_type);
} }
static int static int
...@@ -818,6 +816,8 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ...@@ -818,6 +816,8 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
ql_dbg(ql_dbg_misc, vha, 0xd01a, ql_dbg(ql_dbg_misc, vha, 0xd01a,
"%s: entry count %lx\n", __func__, count); "%s: entry count %lx\n", __func__, count);
while (count--) { while (count--) {
if (buf && *len >= vha->hw->fw_dump_len)
break;
if (qla27xx_find_entry(ent->hdr.entry_type)(vha, ent, buf, len)) if (qla27xx_find_entry(ent->hdr.entry_type)(vha, ent, buf, len))
break; break;
ent = qla27xx_next_entry(ent); ent = qla27xx_next_entry(ent);
...@@ -825,18 +825,20 @@ qla27xx_walk_template(struct scsi_qla_host *vha, ...@@ -825,18 +825,20 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
if (count) if (count)
ql_dbg(ql_dbg_misc, vha, 0xd018, ql_dbg(ql_dbg_misc, vha, 0xd018,
"%s: residual count (%lx)\n", __func__, count); "%s: entry residual count (%lx)\n", __func__, count);
if (ent->hdr.entry_type != ENTRY_TYPE_TMP_END) if (ent->hdr.entry_type != ENTRY_TYPE_TMP_END)
ql_dbg(ql_dbg_misc, vha, 0xd019, ql_dbg(ql_dbg_misc, vha, 0xd019,
"%s: missing end (%lx)\n", __func__, count); "%s: missing end entry (%lx)\n", __func__, count);
ql_dbg(ql_dbg_misc, vha, 0xd01b, if (buf && *len != vha->hw->fw_dump_len)
"%s: len=%lx\n", __func__, *len); ql_dbg(ql_dbg_misc, vha, 0xd01b,
"%s: length=%#lx residual=%+ld\n",
__func__, *len, vha->hw->fw_dump_len - *len);
if (buf) { if (buf) {
ql_log(ql_log_warn, vha, 0xd015, ql_log(ql_log_warn, vha, 0xd015,
"Firmware dump saved to temp buffer (%ld/%p)\n", "Firmware dump saved to temp buffer (%lu/%p)\n",
vha->host_no, vha->hw->fw_dump); vha->host_no, vha->hw->fw_dump);
qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP); qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP);
} }
......
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