diff options
author | NeilBrown <neilb@suse.de> | 2014-04-09 08:35:18 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-05-21 03:54:47 +0200 |
commit | 41bcbc14c432ea80d99ae9148f180c588be08285 (patch) | |
tree | 930409d42356dd390a2087701d69d62201d5597d /super-ddf.c | |
parent | Reshape: use systemd to continue containers as well as native arrays. (diff) | |
download | mdadm-41bcbc14c432ea80d99ae9148f180c588be08285.tar.xz mdadm-41bcbc14c432ea80d99ae9148f180c588be08285.zip |
DDF: more guards against pdnum being negative.
With consistent metdata, pdnum should never be negative,
but it is better to be safe than sorry.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/super-ddf.c b/super-ddf.c index 37ef665a..09bc2d04 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -2059,7 +2059,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha info->disk.major = 0; info->disk.minor = 0; info->disk.state = 0; - if (dl) { + if (dl && dl->pdnum >= 0) { info->disk.major = dl->major; info->disk.minor = dl->minor; info->disk.raid_disk = cd + conf->sec_elmnt_seq @@ -2671,7 +2671,7 @@ static void add_to_super_ddf_bvd(struct supertype *st, dl->minor == dk->minor) break; } - if (!dl || ! (dk->state & (1<<MD_DISK_SYNC))) + if (!dl || dl->pdnum < 0 || ! (dk->state & (1<<MD_DISK_SYNC))) return; vc = &ddf->currentconf->conf; @@ -4030,7 +4030,7 @@ static int compare_super_ddf(struct supertype *st, struct supertype *tst) if (be32_eq(first->phys->entries[pd].refnum, dl1->disk.refnum)) break; - dl1->pdnum = pd; + dl1->pdnum = pd < max_pds ? (int)pd : -1; if (dl2->spare) { if (posix_memalign((void **)&dl1->spare, 512, first->conf_rec_len*512) != 0) { |