]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
validate_geometry_imsm_volume(): Avoid NULL pointer dereference
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 1 Nov 2011 15:09:34 +0000 (16:09 +0100)
committerNeilBrown <neilb@suse.de>
Tue, 1 Nov 2011 23:48:53 +0000 (10:48 +1100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index 34a4b34374d31721a4c7764954e882487682630b..0193fe7fcee9fc7e793b674fa8982cb7c3b340fd 100644 (file)
@@ -5139,7 +5139,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
 {
        struct stat stb;
        struct intel_super *super = st->sb;
 {
        struct stat stb;
        struct intel_super *super = st->sb;
-       struct imsm_super *mpb = super->anchor;
+       struct imsm_super *mpb;
        struct dl *dl;
        unsigned long long pos = 0;
        unsigned long long maxsize;
        struct dl *dl;
        unsigned long long pos = 0;
        unsigned long long maxsize;
@@ -5150,6 +5150,8 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
        if (!super)
                return 0;
 
        if (!super)
                return 0;
 
+       mpb = super->anchor;
+
        if (mpb->num_raid_devs > 0 && mpb->num_disks != raiddisks) {
                fprintf(stderr, Name ": the option-rom requires all "
                        "member disks to be a member of all volumes.\n");
        if (mpb->num_raid_devs > 0 && mpb->num_disks != raiddisks) {
                fprintf(stderr, Name ": the option-rom requires all "
                        "member disks to be a member of all volumes.\n");