From b1f2ff94699aedacb597f89cc300a31a7006877a Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 15 Feb 2014 17:13:04 +0100 Subject: [PATCH] Fixes a possible integer overflow in scrub counting. Conflicts: HISTORY --- HISTORY | 2 ++ scrub.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 945fbeaf..f9d57fc6 100644 --- a/HISTORY +++ b/HISTORY @@ -25,6 +25,8 @@ SnapRAID HISTORY 5.3 2014/2 (BETA) ================= * Don't warn about UUID changed if it's for an empty disk. + * Fixed the number of blocks that scrub has to process when + selecting a high percentage of the array. 5.2 2013/12 =========== diff --git a/scrub.c b/scrub.c index 13dcf9d7..09d43787 100644 --- a/scrub.c +++ b/scrub.c @@ -492,7 +492,7 @@ int state_scrub(struct snapraid_state* state, int percentage, int olderthan) recentlimit = now; } else if (percentage != -1 || olderthan != -1) { if (percentage != -1) - countlimit = (blockmax * percentage + 99) / 100; + countlimit = (blockmax * (uint64_t)percentage + 99) / 100; else countlimit = blockmax; if (olderthan != -1)