diff mbox

crypto: correct 842 decompress for 32 bit

Message ID 1431384816-21606-1-git-send-email-ddstreet@ieee.org (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Dan Streetman May 11, 2015, 10:53 p.m. UTC
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>
---
 lib/842/842_decompress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu May 13, 2015, 3:20 a.m. UTC | #1
On Mon, May 11, 2015 at 06:53:36PM -0400, Dan Streetman wrote:
> 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>

Applied.
diff mbox

Patch

diff --git a/lib/842/842_decompress.c b/lib/842/842_decompress.c
index dbeb058..999b629 100644
--- a/lib/842/842_decompress.c
+++ b/lib/842/842_decompress.c
@@ -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