linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Ferdinand Blomqvist <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, ferdinand.blomqvist@gmail.com,
	tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: [tip:core/rslib] rslib: Fix decoding of shortened codes
Date: Wed, 26 Jun 2019 06:01:58 -0700	[thread overview]
Message-ID: <tip-2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c@git.kernel.org> (raw)
In-Reply-To: <20190620141039.9874-3-ferdinand.blomqvist@gmail.com>

Commit-ID:  2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c
Gitweb:     https://git.kernel.org/tip/2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c
Author:     Ferdinand Blomqvist <ferdinand.blomqvist@gmail.com>
AuthorDate: Thu, 20 Jun 2019 17:10:34 +0300
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 26 Jun 2019 14:55:45 +0200

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 <ferdinand.blomqvist@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190620141039.9874-3-ferdinand.blomqvist@gmail.com

---
 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 100644
--- a/lib/reed_solomon/decode_rs.c
+++ b/lib/reed_solomon/decode_rs.c
@@ -99,9 +99,9 @@
 	if (no_eras > 0) {
 		/* Init lambda to be the erasure locator polynomial */
 		lambda[1] = alpha_to[rs_modnn(rs,
-					      prim * (nn - 1 - eras_pos[0]))];
+					prim * (nn - 1 - (eras_pos[0] + pad)))];
 		for (i = 1; i < no_eras; i++) {
-			u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i]));
+			u = rs_modnn(rs, prim * (nn - 1 - (eras_pos[i] + pad)));
 			for (j = i + 1; j > 0; j--) {
 				tmp = index_of[lambda[j - 1]];
 				if (tmp != nn) {

  reply	other threads:[~2019-06-26 13:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 14:10 [PATCH v2 0/7] rslib: RS decoder is severely broken Ferdinand Blomqvist
2019-06-20 14:10 ` [PATCH v2 1/7] rslib: Add tests for the encoder and decoder Ferdinand Blomqvist
2019-06-26 13:01   ` [tip:core/rslib] " tip-bot for Ferdinand Blomqvist
2019-07-09 18:06   ` [PATCH v2 1/7] " Geert Uytterhoeven
2019-07-09 18:27     ` Thomas Gleixner
2019-06-20 14:10 ` [PATCH v2 2/7] rslib: Fix decoding of shortened codes Ferdinand Blomqvist
2019-06-26 13:01   ` tip-bot for Ferdinand Blomqvist [this message]
2019-06-20 14:10 ` [PATCH v2 3/7] rslib: decode_rs: Fix length parameter check Ferdinand Blomqvist
2019-06-26 13:02   ` [tip:core/rslib] " tip-bot for Ferdinand Blomqvist
2019-06-20 14:10 ` [PATCH v2 4/7] rslib: decode_rs: code cleanup Ferdinand Blomqvist
2019-06-26 13:03   ` [tip:core/rslib] rslib: decode_rs: Code cleanup tip-bot for Ferdinand Blomqvist
2019-06-20 14:10 ` [PATCH v2 5/7] rslib: Fix handling of of caller provided syndrome Ferdinand Blomqvist
2019-06-26 13:04   ` [tip:core/rslib] " tip-bot for Ferdinand Blomqvist
2019-06-20 14:10 ` [PATCH v2 6/7] rslib: Update documentation Ferdinand Blomqvist
2019-06-26 13:04   ` [tip:core/rslib] " tip-bot for Ferdinand Blomqvist
2019-06-20 14:10 ` [PATCH v2 7/7] rslib: Fix remaining decoder flaws Ferdinand Blomqvist
2019-06-26 13:05   ` [tip:core/rslib] " tip-bot for Ferdinand Blomqvist
2019-06-26 12:57 ` [PATCH v2 0/7] rslib: RS decoder is severely broken Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=ferdinand.blomqvist@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).