diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2019-01-15 18:40:20 +0000 |
---|---|---|
committer | Dimitri John Ledkov <xnox@ubuntu.com> | 2019-01-15 18:41:08 +0000 |
commit | ada795fa8e7b1e27c134fe7d5aedf4517cd082f5 (patch) | |
tree | 5717f98c75f6b1a9fbae50b88c35f13d07993226 /debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch | |
parent | 88ee7cfa1e00aabcfc8f48b57f4b226e7b5c2158 (diff) |
New upstream release
* New upstream release
* Cherrypick patches from master up to 757e55435997e355ee9b03e5d913b5496a3c39a8.
Diffstat (limited to 'debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch')
-rw-r--r-- | debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch b/debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch new file mode 100644 index 00000000..37029c1d --- /dev/null +++ b/debian/patches/0008-Grow-avoid-overflow-in-compute_backup_blocks.patch @@ -0,0 +1,34 @@ +From 085df42259cba7863cd6ebe5cd0d8492ac5b869e Mon Sep 17 00:00:00 2001 +From: NeilBrown <neilb@suse.com> +Date: Thu, 6 Dec 2018 10:35:41 +1100 +Subject: [PATCH 08/11] Grow: avoid overflow in compute_backup_blocks() + +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@gmail.com> +Signed-off-by: NeilBrown <neilb@suse.com> +Signed-off-by: Jes Sorensen <jsorensen@fb.com> +--- + Grow.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Grow.c b/Grow.c +index 4436a4d6..76f82c07 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.19.1 + |