]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super0: allow creation of array on 2TB+ devices.
authorNeilBrown <neilb@suse.de>
Mon, 22 Oct 2012 21:48:00 +0000 (08:48 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 22 Oct 2012 21:48:16 +0000 (08:48 +1100)
As 'info->size' is signed, it cannot even hold values above
2TB.
But it isn't used much.  sb->size is the important value and it
is unsigned.
So use that to check for overflow of size.

Reported-by: Eugene San <eugenesan@gmail.com>
super0.c

index bbf7a180339cd3116ed3dd28fda2c0dc6bdb2004..b63de25e1f52bb2d1f42c0336f86bb9439adac16 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -633,9 +633,9 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
        sb->gvalid_words = 0; /* ignored */
        sb->ctime = time(0);
        sb->level = info->level;
-       if (size != (unsigned long long)info->size)
+       sb->size = size;
+       if (size != (unsigned long long)sb->size)
                return 0;
-       sb->size = info->size;
        sb->nr_disks = info->nr_disks;
        sb->raid_disks = info->raid_disks;
        sb->md_minor = info->md_minor;