mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cody Planteen <planteen@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de
Subject: [PATCH 1/2] rslib: Minimum symbol size for a Reed-Solomon code is 2 bits not 1 bit
Date: Sun, 1 Mar 2020 21:27:42 -0700	[thread overview]
Message-ID: <a8a449e6acf1c4e09bd8e7d3b8310cbc315e05a8.1583122776.git.planteen@gmail.com> (raw)
In-Reply-To: <cover.1583122776.git.planteen@gmail.com>

The minimum field for a R-S code is GF(2**2). A code in GF(2**1) would
only be 1 symbol long including data and parity which does not make sense.

Signed-off-by: Cody Planteen <planteen@gmail.com>
---
 include/linux/rslib.h           | 4 ++--
 lib/reed_solomon/reed_solomon.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/rslib.h b/include/linux/rslib.h
index 5974cedd008c..3e48d4302908 100644
--- a/include/linux/rslib.h
+++ b/include/linux/rslib.h
@@ -57,7 +57,7 @@ struct rs_control {
 	uint16_t	buffers[0];
 };
 
-/* General purpose RS codec, 8-bit data width, symbol width 1-15 bit  */
+/* General purpose RS codec, 8-bit data width, symbol width 2-15 bit  */
 #ifdef CONFIG_REED_SOLOMON_ENC8
 int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par,
 	       uint16_t invmsk);
@@ -68,7 +68,7 @@ int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
 	       uint16_t *corr);
 #endif
 
-/* General purpose RS codec, 16-bit data width, symbol width 1-15 bit  */
+/* General purpose RS codec, 16-bit data width, symbol width 2-15 bit  */
 #ifdef CONFIG_REED_SOLOMON_ENC16
 int encode_rs16(struct rs_control *rs, uint16_t *data, int len, uint16_t *par,
 		uint16_t invmsk);
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index bbc01bad3053..357723ac252f 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -219,7 +219,7 @@ static struct rs_control *init_rs_internal(int symsize, int gfpoly,
 	unsigned int bsize;
 
 	/* Sanity checks */
-	if (symsize < 1)
+	if (symsize < 2)
 		return NULL;
 	if (fcr < 0 || fcr >= (1<<symsize))
 		return NULL;
-- 
2.20.1


  reply	other threads:[~2020-03-02  4:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02  4:27 [PATCH 0/2] Reed-Solomon lib parameter fix and test fix Cody Planteen
2020-03-02  4:27 ` Cody Planteen [this message]
2020-03-02  4:27 ` [PATCH 2/2] rslib: test: Yield to prevent RCU stall messages and fix comment typos Cody Planteen
2020-03-05  1:35   ` [rslib] 0a4de944dc: WARNING:bad_unlock_balance_detected kernel test robot

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=a8a449e6acf1c4e09bd8e7d3b8310cbc315e05a8.1583122776.git.planteen@gmail.com \
    --to=planteen@gmail.com \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®