From 73b9b6491970cd5c9f89b9947d9b08338f295e8f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 5 Oct 2013 17:58:55 +0000 Subject: [PATCH] qla2x00t: Avoid reading uninitialized memory (merge r4644 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@5040 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_mbx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qla2x00t/qla_mbx.c b/qla2x00t/qla_mbx.c index e736152da..f87985433 100644 --- a/qla2x00t/qla_mbx.c +++ b/qla2x00t/qla_mbx.c @@ -2805,6 +2805,8 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha, rptid_entry->port_id[2], rptid_entry->port_id[1], rptid_entry->port_id[0])); } else if (rptid_entry->format == 1) { + bool found; + vp_idx = LSB(stat); DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled " "- status %d - " @@ -2818,11 +2820,14 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha, if (MSB(stat) == 1) return; + found = false; list_for_each_entry(vha, &ha->vp_list, vp_list) - if (vp_idx == vha->vp_idx) + if (vp_idx == vha->vp_idx) { + found = true; break; + } - if (!vha) + if (!found) return; vha->d_id.b.domain = rptid_entry->port_id[2];