[PATCH] mdadm/grow: correct size and chunk_size casting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <roman.sobanski@xxxxxxxxx>
---
 Grow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 	}
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux