dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.3.2-fix-resize-of-array-component-size-to-32bits.patch

2ddfcf
commit 0448027b765ec7ede580a1630c23fe7cf4bd0b05
2ddfcf
Author: Justin Maggard <jmaggard10@gmail.com>
2ddfcf
Date:   Fri Oct 24 17:55:02 2014 -0700
2ddfcf
2ddfcf
    Grow: fix resize of array component size to > 32bits
2ddfcf
    
2ddfcf
    If the request --size to --grow an array to is larger
2ddfcf
    than 32bits, then mdadm may make the wrong choice and
2ddfcf
    use ioctl instead of setting component_size via sysfs
2ddfcf
    and the change is ignored.
2ddfcf
    
2ddfcf
    Instead of using casts to check for a 32-bit overflow,
2ddfcf
    just check for set bits outside of INT32_MAX.
2ddfcf
    
2ddfcf
    Fixes: 4e9a3dd16d656b269f5602624ac4f7109a571368
2ddfcf
    Signed-off-by: NeilBrown <neilb@suse.de>
2ddfcf
2ddfcf
diff --git a/Grow.c b/Grow.c
2ddfcf
index 76bb35a..a0f7526 100644
2ddfcf
--- a/Grow.c
2ddfcf
+++ b/Grow.c
2ddfcf
@@ -1818,7 +1818,7 @@ int Grow_reshape(char *devname, int fd,
2ddfcf
 		if (s->size == MAX_SIZE)
2ddfcf
 			s->size = 0;
2ddfcf
 		array.size = s->size;
2ddfcf
-		if (array.size != (signed)s->size) {
2ddfcf
+		if (s->size & ~INT32_MAX) {
2ddfcf
 			/* got truncated to 32bit, write to
2ddfcf
 			 * component_size instead
2ddfcf
 			 */