Grow: fix resize of array component size to > 32bits

If the request --size to --grow an array to is larger
than 32bits, then mdadm may make the wrong choice and
use ioctl instead of setting component_size via sysfs
and the change is ignored.

Instead of using casts to check for a 32-bit overflow,
just check for set bits outside of INT32_MAX.

Fixes: 4e9a3dd16d
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Justin Maggard 2014-10-24 17:55:02 -07:00 committed by NeilBrown
parent da5a36fa1f
commit 0448027b76
1 changed files with 1 additions and 1 deletions

2
Grow.c
View File

@ -1818,7 +1818,7 @@ int Grow_reshape(char *devname, int fd,
if (s->size == MAX_SIZE)
s->size = 0;
array.size = s->size;
if (array.size != (signed)s->size) {
if (s->size & ~INT32_MAX) {
/* got truncated to 32bit, write to
* component_size instead
*/