mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Fix potential division by zero with minuscule devices
This commit is contained in:
parent
00e50bd965
commit
6bfbc6e3b2
1 changed files with 2 additions and 1 deletions
|
|
@ -2101,7 +2101,8 @@ static int devup(dev_t device, const char* name)
|
|||
}
|
||||
|
||||
/* select a random offset */
|
||||
offset = (random_u64() % (size / 4096)) * 4096;
|
||||
uint64_t blocks = size / 4096;
|
||||
offset = blocks > 0 ? (random_u64() % blocks) * 4096 : 0;
|
||||
|
||||
#if HAVE_POSIX_FADVISE
|
||||
/* clear cache */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue