diff options
| author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-09-30 15:51:16 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-10-04 22:22:48 -0400 |
| commit | fd27b571c9f6cf95ddbdf9de7cf0aa8c8cfe8066 (patch) | |
| tree | 60a94e9e832692d11c9af702429dc1cdd2395691 /crypto | |
| parent | 5155e118dda982342c2d21ecb292c8cc8b566e8d (diff) | |
crypto: lrw - fix rebase error after out of bounds fix
Due to an unfortunate interaction between commit fbe1a850b3b1
("crypto: lrw - Fix out-of bounds access on counter overflow") and
commit c778f96bf347 ("crypto: lrw - Optimize tweak computation"),
we ended up with a version of next_index() that always returns 127.
Fixes: c778f96bf347 ("crypto: lrw - Optimize tweak computation")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/lrw.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/lrw.c b/crypto/lrw.c index 6fcf0d431185..0430ccd08728 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
| @@ -122,10 +122,9 @@ static int next_index(u32 *counter) | |||
| 122 | int i, res = 0; | 122 | int i, res = 0; |
| 123 | 123 | ||
| 124 | for (i = 0; i < 4; i++) { | 124 | for (i = 0; i < 4; i++) { |
| 125 | if (counter[i] + 1 != 0) { | 125 | if (counter[i] + 1 != 0) |
| 126 | res += ffz(counter[i]++); | 126 | return res + ffz(counter[i]++); |
| 127 | break; | 127 | |
| 128 | } | ||
| 129 | counter[i] = 0; | 128 | counter[i] = 0; |
| 130 | res += 32; | 129 | res += 32; |
| 131 | } | 130 | } |
