summaryrefslogtreecommitdiff
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-10-23 08:48:00 +1100
committerNeilBrown <neilb@suse.de>2012-10-23 08:48:00 +1100
commit63ebe78faefc47ce8612b619bb25b3438cf8378b (patch)
treeda04a543f172721b198bfb2c30a623a4a9770954 /super0.c
parent79f9f56da68cb99ee3b11a6ec7cbed23572f57cd (diff)
super0: allow creation of array on 2TB+ devices.
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>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/super0.c b/super0.c
index eb902ebd..ecb6b382 100644
--- a/super0.c
+++ b/super0.c
@@ -638,9 +638,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;