]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Incremental.c
mdadm: Specify enough length when write to buffer
[thirdparty/mdadm.git] / Incremental.c
index ba97b008187975681fb2dd65b4378878f2a735ea..0f507bb32c9e574e195104aa1eda8ef66d987e55 100644 (file)
@@ -1034,7 +1034,8 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
                        char chosen_devname[24]; // 2*11 for int (including signs) + colon + null
                        devlist.next = NULL;
                        devlist.used = 0;
-                       devlist.writemostly = 0;
+                       devlist.writemostly = FlagDefault;
+                       devlist.failfast = FlagDefault;
                        devlist.devname = chosen_devname;
                        sprintf(chosen_devname, "%d:%d", major(stb.st_rdev),
                                minor(stb.st_rdev));
@@ -1347,8 +1348,12 @@ restart:
 
                if (devnm && strcmp(devnm, me->devnm) != 0)
                        continue;
-               if (devnm && me->metadata[0] == '/') {
+               if (me->metadata[0] == '/') {
                        char *sl;
+
+                       if (!devnm)
+                               continue;
+
                        /* member array, need to work on container */
                        strncpy(container, me->metadata+1, 32);
                        container[31] = 0;