]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rslib: decode_rs: Fix length parameter check
authorFerdinand Blomqvist <ferdinand.blomqvist@gmail.com>
Thu, 20 Jun 2019 14:10:35 +0000 (17:10 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 26 Jun 2019 12:55:46 +0000 (14:55 +0200)
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 <ferdinand.blomqvist@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190620141039.9874-4-ferdinand.blomqvist@gmail.com
lib/reed_solomon/decode_rs.c

index 3313bf944ff142ecf7fd24a274ed52dd98ca4d81..22006eaa41e65c28bd89a9fbfb9ed111032487f6 100644 (file)
@@ -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)