diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-09-30 21:51:16 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-10-05 10:22:48 +0800 |
commit | b01691261a9a326957986dd997d7286efd9a5fa1 (patch) | |
tree | e5a125ca1a8e02a1e5b3131ad70f8a738222e559 /crypto | |
parent | bedf1358483245b5d200eb0bb24e9e2e903f296e (diff) | |
download | linux-crypto-b01691261a9a326957986dd997d7286efd9a5fa1.tar.gz linux-crypto-b01691261a9a326957986dd997d7286efd9a5fa1.zip |
crypto: lrw - fix rebase error after out of bounds fix
Due to an unfortunate interaction between commit ca30dcf3d917
("crypto: lrw - Fix out-of bounds access on counter overflow") and
commit d1ae9155d30e ("crypto: lrw - Optimize tweak computation"),
we ended up with a version of next_index() that always returns 127.
Fixes: d1ae9155d30e ("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 6fcf0d43..0430ccd0 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c @@ -122,10 +122,9 @@ static int next_index(u32 *counter) int i, res = 0; for (i = 0; i < 4; i++) { - if (counter[i] + 1 != 0) { - res += ffz(counter[i]++); - break; - } + if (counter[i] + 1 != 0) + return res + ffz(counter[i]++); + counter[i] = 0; res += 32; } |