2015-05-11 22:54:03

by Dan Streetman

[permalink] [raw]
Subject: [PATCH] crypto: correct 842 decompress for 32 bit

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 <[email protected]>
Signed-off-by: Dan Streetman <[email protected]>
---
lib/842/842_decompress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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
--
2.1.0


2015-05-13 03:20:26

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: correct 842 decompress for 32 bit

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 <[email protected]>
> Signed-off-by: Dan Streetman <[email protected]>

Applied.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt