summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-11-26 14:19:26 +1100
committerNeilBrown <neilb@suse.de>2009-11-26 14:19:26 +1100
commit2ed4f75388f99968be58097941a9704f6e42d701 (patch)
tree5b24551bb8954fe05fb636069efc5685772e6af0 /Grow.c
parent9277cc7752ae6eb4b10dff7b5fc9ec75d3d52b66 (diff)
downloadmdadm-2ed4f75388f99968be58097941a9704f6e42d701.tar.gz
mdadm-2ed4f75388f99968be58097941a9704f6e42d701.tar.xz
mdadm-2ed4f75388f99968be58097941a9704f6e42d701.zip
Grow: avoid truncation error when checking size of array.
array.size is only 32bit so it is not safe to multiply it up before casting to (long long). Actually, we shouldn't be using array.size here at all, but that will get fixed in a subsequent patch. Reported-by: Andrew Burgess <aab@cichlid.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Grow.c b/Grow.c
index 7764bdb..a654d4e 100644
--- a/Grow.c
+++ b/Grow.c
@@ -891,7 +891,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
}
/* Check that we can hold all the data */
- size = ndata * array.size;
+ size = ndata * (long long)array.size;
get_dev_size(fd, NULL, &array_size);
if (size < (array_size/1024)) {
fprintf(stderr, Name ": this change will reduce the size of the array.\n"