]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
DDF: avoid ref outside array in getinfo_super_ddf_bvd
authorNeilBrown <neilb@suse.de>
Wed, 9 Apr 2014 06:59:49 +0000 (16:59 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 21 May 2014 01:54:47 +0000 (11:54 +1000)
As we are range-checking 'cd', there is a chance that it is not
in-range.  In that case we should include all array indexes with 'cd'
inside the range-tested branch.

Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index f982460b5431f9c080fd0ede604eecfb96fee766..414bdef2a7b28dffa72a7192693532dd31739a45 100644 (file)
@@ -2074,11 +2074,11 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
                        info->component_size = vc->block_sizes[cd];
                else
                        info->component_size = be64_to_cpu(conf->blocks);
-       }
 
-       for (dl = ddf->dlist; dl ; dl = dl->next)
-               if (be32_eq(dl->disk.refnum, conf->phys_refnum[cd]))
-                       break;
+               for (dl = ddf->dlist; dl ; dl = dl->next)
+                       if (be32_eq(dl->disk.refnum, conf->phys_refnum[cd]))
+                               break;
+       }
 
        info->disk.major = 0;
        info->disk.minor = 0;