diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2014-01-06 20:33:59 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-01-15 04:33:35 +0100 |
commit | 5258de8af04af0caf129f1ce432d1817a5800887 (patch) | |
tree | 9ab34cb02735c76c17c92193cafc53468fbd22e6 /drivers/crypto/ccp/ccp-crypto-aes-cmac.c | |
parent | crypto: drivers - Sort drivers/crypto/Makefile (diff) | |
download | linux-5258de8af04af0caf129f1ce432d1817a5800887.tar.xz linux-5258de8af04af0caf129f1ce432d1817a5800887.zip |
crypto: ccp - Apply appropriate gfp_t type to memory allocations
Fix some memory allocations to use the appropriate gfp_t type based
on the CRYPTO_TFM_REQ_MAY_SLEEP flag.
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-crypto-aes-cmac.c')
-rw-r--r-- | drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c index 64dd35e291b0..398832c2414a 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c @@ -61,6 +61,7 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, unsigned int block_size = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); unsigned int len, need_pad, sg_count; + gfp_t gfp; int ret; if (!ctx->u.aes.key_len) @@ -99,7 +100,9 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, * possible data pieces (buffer, input data, padding) */ sg_count = (nbytes) ? sg_nents(req->src) + 2 : 2; - ret = sg_alloc_table(&rctx->data_sg, sg_count, GFP_KERNEL); + gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? + GFP_KERNEL : GFP_ATOMIC; + ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp); if (ret) return ret; |