]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: fix that preventing resize of array to 32bit size.
authorNeilBrown <neilb@suse.de>
Mon, 21 Jul 2014 06:51:53 +0000 (16:51 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 21 Jul 2014 06:51:53 +0000 (16:51 +1000)
If the request --size to --grow an array to is 32bits
(i.e. msb in bit 32) then mdadm make wrong choice and
uses ioctl instead of setting component_size via sysfs
and the change is ignored.

This is fixed by using correct casts.

Reported-and-tested-by: Killian De Volder <killian.de.volder@megasoft.be>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index ea9cc60e1f182cc1cce8d0d6226a2477088bc120..af59347ca75ee3c8285649c22bbb5617213aff9c 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1813,7 +1813,7 @@ int Grow_reshape(char *devname, int fd,
                if (s->size == MAX_SIZE)
                        s->size = 0;
                array.size = s->size;
-               if ((unsigned)array.size != s->size) {
+               if (array.size != (signed)s->size) {
                        /* got truncated to 32bit, write to
                         * component_size instead
                         */