[PATCH 1/2] imsm: Fix: klocwork: targets variable can be used uninitialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When target_offsets allocation fails execution goes to abort label,
where elements from targets table are closed.

Initialize targets table after allocation.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 super-intel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 40fd940..8dd0805 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -7724,6 +7724,9 @@ int save_backup_imsm(struct supertype *st,
 	if (!targets)
 		goto abort;
 
+	for (i = 0; i < new_disks; i++)
+		targets[i] = -1;
+
 	target_offsets = malloc(new_disks * sizeof(unsigned long long));
 	if (!target_offsets)
 		goto abort;

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux