rslib: Fix decoding of shortened codes
authorFerdinand Blomqvist <ferdinand.blomqvist@gmail.com>
Thu, 20 Jun 2019 14:10:34 +0000 (17:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:12 +0000 (09:14 +0200)
commit8ba93c59441a368749337318e78c8c1db07677b9
treee36af4fcb36e186f7bcd8decd8c11965d409b766
parentdad0b17e4a4e68df83e2904034e76a94c0a82d91
rslib: Fix decoding of shortened codes

[ Upstream commit 2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/reed_solomon/decode_rs.c