projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
647cc9e
)
rslib: Fix handling of of caller provided syndrome
author
Ferdinand Blomqvist
<ferdinand.blomqvist@gmail.com>
Thu, 20 Jun 2019 14:10:37 +0000
(17:10 +0300)
committer
Thomas Gleixner
<tglx@linutronix.de>
Wed, 26 Jun 2019 12:55:47 +0000
(14:55 +0200)
Check if the syndrome provided by the caller is zero, and act
accordingly.
Signed-off-by: Ferdinand Blomqvist <ferdinand.blomqvist@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link:
https://lkml.kernel.org/r/20190620141039.9874-6-ferdinand.blomqvist@gmail.com
lib/reed_solomon/decode_rs.c
patch
|
blob
|
history
diff --git
a/lib/reed_solomon/decode_rs.c
b/lib/reed_solomon/decode_rs.c
index 78629bbe6590bf47b39534f3833191ba99833f43..b7264a712d462f7cc3cd31dc655ad58ce1420895 100644
(file)
--- a/
lib/reed_solomon/decode_rs.c
+++ b/
lib/reed_solomon/decode_rs.c
@@
-42,8
+42,18
@@
BUG_ON(pad < 0 || pad >= nn - nroots);
/* Does the caller provide the syndrome ? */
- if (s != NULL)
- goto decode;
+ if (s != NULL) {
+ for (i = 0; i < nroots; i++) {
+ /* The syndrome is in index form,
+ * so nn represents zero
+ */
+ if (s[i] != nn)
+ goto decode;
+ }
+
+ /* syndrome is zero, no errors to correct */
+ return 0;
+ }
/* form the syndromes; i.e., evaluate data(x) at roots of
* g(x) */