| ede7c247 | 02-Jul-2019 |
YueHaibing <[email protected]> |
rslib: Make some functions static
Fix sparse warnings:
lib/reed_solomon/test_rslib.c:313:5: warning: symbol 'ex_rs_helper' was not declared. Should it be static? lib/reed_solomon/test_rslib.c:349:5
rslib: Make some functions static
Fix sparse warnings:
lib/reed_solomon/test_rslib.c:313:5: warning: symbol 'ex_rs_helper' was not declared. Should it be static? lib/reed_solomon/test_rslib.c:349:5: warning: symbol 'exercise_rs' was not declared. Should it be static? lib/reed_solomon/test_rslib.c:407:5: warning: symbol 'exercise_rs_bc' was not declared. Should it be static?
Reported-by: Hulk Robot <[email protected]> Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| 991305de | 20-Jun-2019 |
Ferdinand Blomqvist <[email protected]> |
rslib: Fix remaining decoder flaws
The decoder is flawed in the following ways:
- The decoder sometimes fails silently, i.e. it announces success but returns a word that is not a codeword.
- The
rslib: Fix remaining decoder flaws
The decoder is flawed in the following ways:
- The decoder sometimes fails silently, i.e. it announces success but returns a word that is not a codeword.
- The return value of the decoder is incoherent with respect to how fixed erasures are counted. If the word to be decoded is a codeword, then the decoder always returns zero even if some erasures are given. On the other hand, if the word to be decoded contains errors, then the number of erasures is always included in the count of corrected symbols. So the decoder handles erasures without symbol corruption inconsistently. This inconsistency probably doesn't affect anyone using the decoder, but it is inconsistent with the documentation.
- The error positions returned in eras_pos include all erasures, but the corrections are only set in the correction buffer if there actually is a symbol error. So if there are erasures without symbol corruption, then the correction buffer will contain errors (unless initialized to zero before calling the decoder) or some values will be unset (if the correction buffer is uninitialized).
- When correcting data in-place the decoder does not correct errors in the parity. On the other hand, when returning the errors in correction buffers, errors in the parity are included.
The respective fixed are:
- The syndrome of a codeword is always zero, and the syndrome is linear, .i.e, S(x+e) = S(x) + S(e). So compute the syndrome for the error and check whether it equals the syndrome of the received word. If it does, then we have decoded to a valid codeword, otherwise we know that we have an uncorrectable error. Fortunately, some unrecoverable error conditions can be detected earlier in the decoding, which saves some processing power.
- Simply count and return the number of symbols actually corrected.
- Make sure to only return positions where symbols were corrected.
- Also fix errors in parity when correcting in-place. Another option would be to completely disregard errors in the parity, but then the interface makes it impossible to write tests that test for silent failures.
Other changes:
- Only fill the correction buffer and error position buffer if both of them are provided. Otherwise correct in place. Previously the error position buffer was always populated with the positions of the corrected errors, irrespective of whether a correction buffer was supplied or not. The rationale for this change is that there seems to be two use cases for the decoder; correct in-place or use the correction buffers. The caller does not need the positions of the corrected errors when in-place correction is used. If in-place correction is not used, then both the correction buffer and error position buffer need to be populated.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| 38cbae14 | 20-Jun-2019 |
Ferdinand Blomqvist <[email protected]> |
rslib: Update documentation
The decoder returns the number of corrected symbols, not bits. The caller provided syndrome must be in index form.
Signed-off-by: Ferdinand Blomqvist <ferdinand.blomqvis
rslib: Update documentation
The decoder returns the number of corrected symbols, not bits. The caller provided syndrome must be in index form.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| ef4d6a85 | 20-Jun-2019 |
Ferdinand Blomqvist <[email protected]> |
rslib: Fix handling of of caller provided syndrome
Check if the syndrome provided by the caller is zero, and act accordingly.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Sign
rslib: Fix handling of of caller provided syndrome
Check if the syndrome provided by the caller is zero, and act accordingly.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| a343536f | 20-Jun-2019 |
Ferdinand Blomqvist <[email protected]> |
rslib: decode_rs: Fix length parameter check
The length of the data load must be at least one. Or in other words, there must be room for at least 1 data and nroots parity symbols after shortening th
rslib: decode_rs: Fix length parameter check
The length of the data load must be at least one. Or in other words, there must be room for at least 1 data and nroots parity symbols after shortening the RS code.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| 2034a42d | 20-Jun-2019 |
Ferdinand Blomqvist <[email protected]> |
rslib: Fix decoding of shortened codes
The decoding of shortenend codes is broken. It only works as expected if there are no erasures.
When decoding with erasures, Lambda (the error and erasure loc
rslib: Fix decoding of shortened codes
The decoding of shortenend codes is broken. It only works as expected if there are no erasures.
When decoding with erasures, Lambda (the error and erasure locator polynomial) is initialized from the given erasure positions. The pad parameter is not accounted for by the initialisation code, and hence Lambda is initialized from incorrect erasure positions.
The fix is to adjust the erasure positions by the supplied pad.
Signed-off-by: Ferdinand Blomqvist <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
show more ...
|
| 21633981 | 22-Apr-2018 |
Thomas Gleixner <[email protected]> |
rslib: Split rs control struct
The decoder library uses variable length arrays on stack. To get rid of them it would be simple to allocate fixed length arrays on stack, but those might become rather
rslib: Split rs control struct
The decoder library uses variable length arrays on stack. To get rid of them it would be simple to allocate fixed length arrays on stack, but those might become rather large. The other solution is to allocate the buffers in the rs control structure, but this cannot be done as long as the structure can be shared by several users. Sharing is desired because the RS polynom tables are large and initialization is time consuming.
To solve this split the codec information out of the control structure and have a pointer to a shared codec in it. Instantiate the control structure for each user, create a new codec if no shareable is avaiable yet. Adjust all affected usage sites to the new scheme.
This allows to add per instance decoder buffers to the control structure later on.
Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Boris Brezillon <[email protected]> Cc: Tony Luck <[email protected]> Cc: Kees Cook <[email protected]> Cc: Segher Boessenkool <[email protected]> Cc: Kernel Hardening <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: Anton Vorontsov <[email protected]> Cc: Colin Cross <[email protected]> Cc: Andrew Morton <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Alasdair Kergon <[email protected]> Signed-off-by: Kees Cook <[email protected]>
show more ...
|
| a85e126a | 22-Apr-2018 |
Thomas Gleixner <[email protected]> |
rslib: Simplify error path
The four error path labels in rs_init() can be reduced to one by allocating the struct with kzalloc so the pointers in the struct are NULL and can be unconditionally hande
rslib: Simplify error path
The four error path labels in rs_init() can be reduced to one by allocating the struct with kzalloc so the pointers in the struct are NULL and can be unconditionally handed in to kfree() because they either point to an allocation or are NULL.
Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Kees Cook <[email protected]>
show more ...
|
| 689c6efd | 22-Apr-2018 |
Thomas Gleixner <[email protected]> |
rslib: Remove GPL boilerplate
Now that SPDX identifiers are in place, remove the GPL boiler plate text. Leave the notices which document that Phil Karn granted permission in place (encode/decode sou
rslib: Remove GPL boilerplate
Now that SPDX identifiers are in place, remove the GPL boiler plate text. Leave the notices which document that Phil Karn granted permission in place (encode/decode source code). The modified files are code written for the kernel by me.
Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Cc: Boris Brezillon <[email protected]> Cc: Tony Luck <[email protected]> Cc: Kees Cook <[email protected]> Cc: Segher Boessenkool <[email protected]> Cc: Kernel Hardening <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: Anton Vorontsov <[email protected]> Cc: Colin Cross <[email protected]> Cc: Andrew Morton <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Alasdair Kergon <[email protected]> Signed-off-by: Kees Cook <[email protected]>
show more ...
|