diff options
author | Cristian Stoica <cristian.stoica@freescale.com> | 2014-08-14 13:51:57 +0300 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2014-12-22 13:03:46 +0800 |
commit | 53a7b1f8c0b157cc0bf672379859f335e80baaae (patch) | |
tree | 301f0d862f30a418bb175c3aeadfee1644fe1234 /drivers | |
parent | 484ba62c1a37a7738506b59a46df11391b11a6f3 (diff) |
crypto: caam - fix addressing of struct member
commit 4451d494b1910bf7b7f8381a637d0fe6d2142467 upstream.
buf_0 and buf_1 in caam_hash_state are not next to each other.
Accessing buf_1 is incorrect from &buf_0 with an offset of only
size_of(buf_0). The same issue is also with buflen_0 and buflen_1
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cad4e11a9778eee2e8c52e1df7bf1008fb49a580)
(cherry picked from commit 96e048ff8c7c62e2f1fe06f0da1fea791a220c0e)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 1940f556950a..cae8da1de934 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -1609,9 +1609,9 @@ static int ahash_update_first(struct ahash_request *req) struct device *jrdev = ctx->jrdev; gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC; - u8 *next_buf = state->buf_0 + state->current_buf * - CAAM_MAX_HASH_BLOCK_SIZE; - int *next_buflen = &state->buflen_0 + state->current_buf; + u8 *next_buf = state->current_buf ? state->buf_1 : state->buf_0; + int *next_buflen = state->current_buf ? + &state->buflen_1 : &state->buflen_0; int to_hash; u32 *sh_desc = ctx->sh_desc_update_first, *desc; dma_addr_t ptr = ctx->sh_desc_update_first_dma; |