forked from pool/mdadm
20d4d9c005
0002-policy-support-devices-with-multiple-paths.patch 0008-policy.c-prevent-NULL-pointer-referencing.patch (bsc#1106078) - 0003-mdcheck-add-systemd-unit-files-to-run-mdcheck.patch 0004-Monitor-add-system-timer-to-run-oneshot-periodically.patch Remove mdadm.cron Remove crond.mdadm (bsc#1115407) - 0005-imsm-update-metadata-correctly-while-raid10-double-d.patch 0006-Grow-avoid-overflow-in-compute_backup_blocks.patch 0007-Grow-report-correct-new-chunk-size.patch Other useful upstream patches. OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=168
35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
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] 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 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
|
|
|