From d178fa8da996eb74224549c5d11f08cea08847d3 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 13 Dec 2012 21:28:10 +0000 Subject: [PATCH] qla2x00t: Avoid reading uninitialized memory Reported-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4644 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];