diff options
author | Adam Kwolek <adam.kwolek@intel.com> | 2011-06-14 12:48:53 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-06-14 12:48:53 +1000 |
commit | 7e45b5504c66d29b77c16f59dc4f8f0de72145ba (patch) | |
tree | 9c6f99b92da03bdbeafdcf676ba1498cf9062562 | |
parent | e1c1d4f4427c0b2bc61914930de55019fdd3dabd (diff) | |
download | mdadm-7e45b5504c66d29b77c16f59dc4f8f0de72145ba.tar.gz |
imsm: Fix: klocwork: targets variable can be used uninitialized
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@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | super-intel.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c index 7190f51..6c74e50 100644 --- a/super-intel.c +++ b/super-intel.c @@ -7716,13 +7716,15 @@ 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; start = info->reshape_progress * 512; for (i = 0; i < new_disks; i++) { - targets[i] = -1; target_offsets[i] = (unsigned long long) __le32_to_cpu(super->migr_rec->ckpt_area_pba) * 512; /* move back copy area adderss, it will be moved forward |