Skip to content

Commit

Permalink
rslib: decode_rs: Fix length parameter check
Browse files Browse the repository at this point in the history
The length of the data load must be at least one. Or in other words,
there must be room for at least 1 data and nroots parity symbols after
shortening the RS code.

Signed-off-by: Ferdinand Blomqvist <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
fblomqvi authored and KAGA-KOKO committed Jun 26, 2019
1 parent 2034a42 commit a343536
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reed_solomon/decode_rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

/* Check length parameter for validity */
pad = nn - nroots - len;
BUG_ON(pad < 0 || pad >= nn);
BUG_ON(pad < 0 || pad >= nn - nroots);

/* Does the caller provide the syndrome ? */
if (s != NULL)
Expand Down

0 comments on commit a343536

Please sign in to comment.