From abfa580ad700415f5ea240450a1621f9de35de82 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 26 Mar 2024 21:38:48 -0700 Subject: [PATCH] altos: ao_fec_prepare using wrong value for input len The FEC code always sends a multiple of four bytes, padding by two bytes for even inputs and one byte for odd. But the preparation step was using the wrong value for the length, so the output was getting mangled. Signed-off-by: Keith Packard --- src/kernel/ao_fec_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/ao_fec_tx.c b/src/kernel/ao_fec_tx.c index 8c0e7db4..209581b8 100644 --- a/src/kernel/ao_fec_tx.c +++ b/src/kernel/ao_fec_tx.c @@ -74,7 +74,7 @@ ao_fec_prepare(const uint8_t *in, uint8_t len, uint8_t *extra) extra[i++] = (uint8_t) crc; /* Append FEC -- 1 byte if odd, two bytes if even */ - num_fec = 2 - (i & 1); + num_fec = 2 - (len & 1); while (num_fec--) extra[i++] = AO_FEC_TRELLIS_TERMINATOR; return i; -- 2.30.2