From: Roman Sobanski Date: Fri, 27 Apr 2018 10:12:21 +0000 (+0200) Subject: mdadm/grow: correct size and chunk_size casting X-Git-Tag: mdadm-4.1-rc2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d518de84e7cd3382b4984cc1243ddb4102aa4f4;p=thirdparty%2Fmdadm.git mdadm/grow: correct size and chunk_size casting With commit 4b74a905a67e ("mdadm/grow: Component size must be larger than chunk size") mdadm returns incorrect message if size given to grow was greater than 2 147 483 647 K. Cast chunk_size to "unsigned long long" instead of casting size to "int". Signed-off-by: Roman Sobanski Signed-off-by: Jes Sorensen --- diff --git a/Grow.c b/Grow.c index 87229692..a4be7e7b 100644 --- a/Grow.c +++ b/Grow.c @@ -1821,7 +1821,7 @@ int Grow_reshape(char *devname, int fd, } if (array.level > 1 && s->size > 1 && - (array.chunk_size / 1024) > (int)s->size) { + (unsigned long long) (array.chunk_size / 1024) > s->size) { pr_err("component size must be larger than chunk size.\n"); return 1; }