[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8a449e6acf1c4e09bd8e7d3b8310cbc315e05a8.1583122776.git.planteen@gmail.com>
Date: Sun, 1 Mar 2020 21:27:42 -0700
From: Cody Planteen <planteen@...il.com>
To: linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de
Subject: [PATCH 1/2] rslib: Minimum symbol size for a Reed-Solomon code is 2
bits not 1 bit
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@...il.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
Powered by blists - more mailing lists