]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
DDF: Fix NULL pointer dereference in validate_geometry_ddf()
[thirdparty/mdadm.git] / super-ddf.c
index 9d867f6910f39347d1b7dda97c6a8c4dba276799..949e7d15547466701ffc39d507002fb2fb4f87b1 100644 (file)
@@ -3369,9 +3369,6 @@ static int validate_geometry_ddf(struct supertype *st,
         * If given BVDs, we make an SVD, changing all the GUIDs in the process.
         */
 
-       if (*chunk == UnSet)
-               *chunk = DEFAULT_CHUNK;
-
        if (level == LEVEL_NONE)
                level = LEVEL_CONTAINER;
        if (level == LEVEL_CONTAINER) {
@@ -3381,6 +3378,9 @@ static int validate_geometry_ddf(struct supertype *st,
                                                       freesize, verbose);
        }
 
+       if (*chunk == UnSet)
+               *chunk = DEFAULT_CHUNK;
+
        if (!dev) {
                mdu_array_info_t array = {
                        .level = level,