With a chunk size of 16Meg and data drive count of 8, this calculate can easily overflow the 'int' type that is used for the multiplications. So force it to use "long" instead. Reported-and-tested-by: Ed Spiridonov <edo.rus@xxxxxxxxx> Signed-off-by: NeilBrown <neilb@xxxxxxxx> --- Grow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Grow.c b/Grow.c index 4436a4d6bd4c..76f82c075e38 100644 --- a/Grow.c +++ b/Grow.c @@ -1196,7 +1196,8 @@ unsigned long compute_backup_blocks(int nchunk, int ochunk, /* Find GCD */ a = GCD(a, b); /* LCM == product / GCD */ - blocks = (ochunk/512) * (nchunk/512) * odata * ndata / a; + blocks = (unsigned long)(ochunk/512) * (unsigned long)(nchunk/512) * + odata * ndata / a; return blocks; } -- 2.14.0.rc0.dirty
Attachment:
signature.asc
Description: PGP signature