Commit 350cbe24 authored by Ferdinand Blomqvist's avatar Ferdinand Blomqvist Committed by Stefan Bader

rslib: Fix handling of of caller provided syndrome

BugLink: https://bugs.launchpad.net/bugs/1840081

[ Upstream commit ef4d6a85 ]

Check if the syndrome provided by the caller is zero, and act
accordingly.
Signed-off-by: default avatarFerdinand Blomqvist <ferdinand.blomqvist@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190620141039.9874-6-ferdinand.blomqvist@gmail.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 73b71649
...@@ -42,8 +42,18 @@ ...@@ -42,8 +42,18 @@
BUG_ON(pad < 0 || pad >= nn); BUG_ON(pad < 0 || pad >= nn);
/* Does the caller provide the syndrome ? */ /* Does the caller provide the syndrome ? */
if (s != NULL) if (s != NULL) {
goto decode; 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 /* form the syndromes; i.e., evaluate data(x) at roots of
* g(x) */ * g(x) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment