lib: correct 842 decompress for 32 bit
authorDan Streetman <ddstreet@ieee.org>
Mon, 11 May 2015 22:53:36 +0000 (18:53 -0400)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 13 May 2015 02:31:59 +0000 (10:31 +0800)
Avoid 64 bit mod operation, which won't work on 32 bit systems.
Simple subtraction can be used instead in this case.

Reported-By: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
lib/842/842_decompress.c

index dbeb0581b879b71b1c5a0d14652137dc70e40adb..5446ff0c9ba0f186448cffc34942858dc1a7d0a9 100644 (file)
@@ -185,7 +185,7 @@ static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize)
                /* this is where the current fifo is */
                u64 section = round_down(total, fsize);
                /* the current pos in the fifo */
-               u64 pos = total % fsize;
+               u64 pos = total - section;
 
                /* if the offset is past/at the pos, we need to
                 * go back to the last fifo section