mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Return -1 in raid_check and raid_scan when block size is 0
This commit is contained in:
parent
46a09a380a
commit
e43bdda22b
1 changed files with 6 additions and 0 deletions
|
|
@ -138,6 +138,9 @@ int raid_check(int nr, int *ir, int nd, int np, size_t size, void **v)
|
|||
BUG_ON(nr > 0 && ir[0] < 0);
|
||||
BUG_ON(nr > 0 && ir[nr - 1] >= nd + np);
|
||||
|
||||
if (size == 0)
|
||||
return -1;
|
||||
|
||||
/* count failed data disk */
|
||||
rd = 0;
|
||||
while (rd < nr && ir[rd] < nd)
|
||||
|
|
@ -178,6 +181,9 @@ int raid_scan(int *ir, int nd, int np, size_t size, void **v)
|
|||
BUG_ON(v == 0);
|
||||
BUG_ON(np > 1 && ir == 0);
|
||||
|
||||
if (size == 0)
|
||||
return -1;
|
||||
|
||||
/* check the special case of no failure */
|
||||
if (np != 0 && raid_check(0, 0, nd, np, size, v) == 0)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue