Fix the extended integrity checks in the liberasurecode decode

function.  Previously, it was failing if the number of invalid
fragments was k or greater, which is incorrect.

We should only be able to decode if:

  (num given fragments - num invalid fragments) >= k

This means fail if:

  (num given fragments - num invalid fragments) < k
This commit is contained in:
Kevin Greenan 2015-02-07 14:39:40 -08:00
parent cf490de5e0
commit 14b1e5bb64
1 changed files with 1 additions and 1 deletions

View File

@ -594,7 +594,7 @@ int liberasurecode_decode(int desc,
++num_invalid_fragments;
}
}
if (num_invalid_fragments > (k - 1)) {
if ((num_fragments - num_invalid_fragments) < k) {
ret = -EINSUFFFRAGS;
log_error("Not enough valid fragments available for decode!");
goto out;