lkml.org 
[lkml]   [2020]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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@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
\
 
 \ /
  Last update: 2020-03-02 05:29    [W:0.029 / U:13.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site