From: Stephen M. Cameron Date: Fri, 7 Jan 2011 16:55:43 +0000 (-0600) Subject: [SCSI] hpsa: fix use of uninitialized variable in hpsa_add_msa2xxx_enclosure_device() X-Git-Tag: firefly_0821_release~7613^2~2168^2~149 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c4f8a299d04bd083643ba93e982ab910219dd1f0;p=firefly-linux-kernel-4.4.55.git [SCSI] hpsa: fix use of uninitialized variable in hpsa_add_msa2xxx_enclosure_device() Thanks to Scott Teel for noticing this. Signed-off-by: Stephen M. Cameron Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index c255f46e6405..c6c13b0c68eb 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -1617,6 +1617,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */ return 0; + memset(scsi3addr, 0, 8); + scsi3addr[3] = target; if (is_hba_lunid(scsi3addr)) return 0; /* Don't add the RAID controller here. */ @@ -1631,8 +1633,6 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, return 0; } - memset(scsi3addr, 0, 8); - scsi3addr[3] = target; if (hpsa_update_device_info(h, scsi3addr, this_device)) return 0; (*nmsa2xxx_enclosures)++;