Re: [RFC] Reed-Solomon Code: Update no_eras to the actual number of errors

2020-06-25 Thread Ferdinand Blomqvist
should be improved :) But, I do agree that it is not that easy to call the functions correctly. Best, Ferdinand -- Ferdinand Blomqvist ferdinand.blomqvist[at]gmail.com GPG key: 9EFB 7A2C 0432 4EC5 32BA FA61 CFE9 4164 93E8 B9E4

Re: [RFC v2] Reed-Solomon Code: Update no_eras to the actual number of errors

2020-06-25 Thread Ferdinand Blomqvist
j++; } + if (no_eras) + *no_eras = j; Same as above. 2.25.1 Best, Ferdinand -- Ferdinand Blomqvist ferdinand.blomqvist[at]gmail.com GPG key: 9EFB 7A2C 0432 4EC5 32BA FA61 CFE9 4164 93E8 B9E4

[tip:core/rslib] rslib: Fix remaining decoder flaws

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: 991305dee585dd9e3107b2e253778ed02ee3fbd1 Gitweb: https://git.kernel.org/tip/991305dee585dd9e3107b2e253778ed02ee3fbd1 Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:39 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:47 +0200 rslib: Fix

[tip:core/rslib] rslib: Update documentation

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: 38cbae1434f8f7bbd8eaf24b29a385a4b88938fb Gitweb: https://git.kernel.org/tip/38cbae1434f8f7bbd8eaf24b29a385a4b88938fb Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:38 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:47 +0200 rslib: Update

[tip:core/rslib] rslib: Fix handling of of caller provided syndrome

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: ef4d6a8556b637ad27c8c2a2cff1dda3da38e9a9 Gitweb: https://git.kernel.org/tip/ef4d6a8556b637ad27c8c2a2cff1dda3da38e9a9 Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:37 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:47 +0200 rslib: Fix

[tip:core/rslib] rslib: decode_rs: Code cleanup

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: 647cc9ece63fdba573a31bdafa54fb2d388c3c83 Gitweb: https://git.kernel.org/tip/647cc9ece63fdba573a31bdafa54fb2d388c3c83 Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:36 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:46 +0200 rslib

[tip:core/rslib] rslib: decode_rs: Fix length parameter check

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: a343536f8f482be6932803a023f46d0fa723ae56 Gitweb: https://git.kernel.org/tip/a343536f8f482be6932803a023f46d0fa723ae56 Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:35 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:46 +0200 rslib

[tip:core/rslib] rslib: Fix decoding of shortened codes

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: 2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c Gitweb: https://git.kernel.org/tip/2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:34 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:45 +0200 rslib: Fix

[tip:core/rslib] rslib: Add tests for the encoder and decoder

2019-06-26 Thread tip-bot for Ferdinand Blomqvist
Commit-ID: 4b4f3accd80304781c648b26ce4d53df082a4087 Gitweb: https://git.kernel.org/tip/4b4f3accd80304781c648b26ce4d53df082a4087 Author: Ferdinand Blomqvist AuthorDate: Thu, 20 Jun 2019 17:10:33 +0300 Committer: Thomas Gleixner CommitDate: Wed, 26 Jun 2019 14:55:45 +0200 rslib: Add

[PATCH v2 4/7] rslib: decode_rs: code cleanup

2019-06-20 Thread Ferdinand Blomqvist
Nothing useful was done after the finish label when count is negative so return directly instead of jumping to finish. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b

[PATCH v2 3/7] rslib: decode_rs: Fix length parameter check

2019-06-20 Thread Ferdinand Blomqvist
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 --- lib/reed_solomon/decode_rs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v2 0/7] rslib: RS decoder is severely broken

2019-06-20 Thread Ferdinand Blomqvist
alling decode_rs16. Maybe this is needed because of the bugs in the decoder? Ferdinand Blomqvist (7): rslib: Add tests for the encoder and decoder rslib: Fix decoding of shortened codes rslib: decode_rs: Fix length parameter check rslib: decode_rs: code cleanup rslib: Fix handling of of

[PATCH v2 2/7] rslib: Fix decoding of shortened codes

2019-06-20 Thread Ferdinand Blomqvist
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 --- lib/reed_solomon/decode_rs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b

[PATCH v2 7/7] rslib: Fix remaining decoder flaws

2019-06-20 Thread Ferdinand Blomqvist
place correction is not used, then both the correction buffer and error position buffer need to be populated. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 88 1 file changed, 68 insertions(+), 20 deletions(-) diff --git

[PATCH v2 6/7] rslib: Update documentation

2019-06-20 Thread Ferdinand Blomqvist
The decoder returns the number of corrected symbols, not bits. The caller provided syndrome must be in index form. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/reed_solomon.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/reed_solomon

[PATCH v2 1/7] rslib: Add tests for the encoder and decoder

2019-06-20 Thread Ferdinand Blomqvist
on/test_rslib.c @@ -0,0 +1,516 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Tests for Generic Reed Solomon encoder / decoder library + * + * Written by Ferdinand Blomqvist + * Based on previous work by Phil Karn, KA9Q + */ +#include +#include +#include +#include +#include +#include + +enum verbo

[PATCH v2 5/7] rslib: Fix handling of of caller provided syndrome

2019-06-20 Thread Ferdinand Blomqvist
Check if the syndrome provided by the caller is zero, and act accordingly. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index

Re: [RFC PATCH 7/7] rslib: Fix remaining decoder flaws

2019-06-20 Thread Ferdinand Blomqvist
Hi, On 2019-06-17 23:00:27, Thomas Gleixner wrote: On Sat, 30 Mar 2019, Ferdinand Blomqvist wrote: The decoder is flawed in the following ways: ... Aside of the fact that I had to wrap my brain around this crime I committed more than a decade ago, all of this was really a pleasure to review

Re: [RFC PATCH 0/7] rslib: RS decoder is severely broken

2019-05-09 Thread Ferdinand Blomqvist
On 2019-04-04 13:24:05, Thomas Gleixner wrote: Ferdinand, On Sat, 30 Mar 2019, Ferdinand Blomqvist wrote: Thanks for providing that! I'm short of cycles to go through that right now, but will do in the foreseeable future. Feel free to remind me if I don't do so within two week

[RFC PATCH 1/7] rslib: Add tests for the encoder and decoder

2019-03-30 Thread Ferdinand Blomqvist
on/test_rslib.c @@ -0,0 +1,519 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Tests for Generic Reed Solomon encoder / decoder library + * + * Written by Ferdinand Blomqvist + * Based on previous work by Phil Karn, KA9Q + */ +#include +#include +#include +#include +#include +#include + +enum verbo

[RFC PATCH 6/7] rslib: Update documentation

2019-03-30 Thread Ferdinand Blomqvist
The decoder returns the number of corrected symbols, not bits. The caller provided syndrome must be in index form. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/reed_solomon.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/reed_solomon

[RFC PATCH 7/7] rslib: Fix remaining decoder flaws

2019-03-30 Thread Ferdinand Blomqvist
place correction is not used, then both the correction buffer and error position buffer need to be populated. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 87 +++- 1 file changed, 67 insertions(+), 20 deletions(-) diff --git

[RFC PATCH 5/7] rslib: Fix handling of of caller provided syndrome

2019-03-30 Thread Ferdinand Blomqvist
Check if the syndrome provided by the caller is zero, and act accordingly. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index

[RFC PATCH 2/7] rslib: Fix decoding of shortened codes

2019-03-30 Thread Ferdinand Blomqvist
The decoder is broken. It only works with full length codes. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index 1db74eb098d0..3313bf944ff1

[RFC PATCH 4/7] rslib: decode_rs: code cleanup

2019-03-30 Thread Ferdinand Blomqvist
Nothing useful was done after the finish label when count is negative so return directly instead of jumping to finish. Signed-off-by: Ferdinand Blomqvist --- lib/reed_solomon/decode_rs.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b

[RFC PATCH 3/7] rslib: decode_rs: Fix length parameter check

2019-03-30 Thread Ferdinand Blomqvist
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 --- lib/reed_solomon/decode_rs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[RFC PATCH 0/7] rslib: RS decoder is severely broken

2019-03-30 Thread Ferdinand Blomqvist
n two of the drivers that use rslib: drivers/mtd/nand/raw/cafe_nand.c drivers/mtd/nand/raw/diskonchip.c Both of them seem to do some additional error checking after calling decode_rs16. Maybe this is needed because of the bugs in the decoder? Ferdinand Blomqvist (7): rslib: Add tests for the