diff options
author | James Morris <james.l.morris@oracle.com> | 2017-12-11 17:01:08 +1100 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-12-11 17:01:08 +1100 |
commit | 4a06f454768a7e11e8f10b900b450786546cbba1 (patch) | |
tree | 149f57c9ce794734883e326d63040b1381dc1a59 /crypto/shash.c | |
parent | fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec (diff) | |
parent | 8dce1988dfaa3668372990f05ee2202d9d9521b5 (diff) | |
download | linux-crypto-4a06f454768a7e11e8f10b900b450786546cbba1.tar.gz linux-crypto-4a06f454768a7e11e8f10b900b450786546cbba1.zip |
Sync to v4.15-rc3 for security subsystem developers to work against.
Diffstat (limited to '')
-rw-r--r-- | crypto/shash.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index 5e31c8d7..325a14da 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -41,7 +41,7 @@ static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, int err; absize = keylen + (alignmask & ~(crypto_tfm_ctx_alignment() - 1)); - buffer = kmalloc(absize, GFP_KERNEL); + buffer = kmalloc(absize, GFP_ATOMIC); if (!buffer) return -ENOMEM; @@ -275,12 +275,14 @@ static int shash_async_finup(struct ahash_request *req) int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc) { - struct scatterlist *sg = req->src; - unsigned int offset = sg->offset; unsigned int nbytes = req->nbytes; + struct scatterlist *sg; + unsigned int offset; int err; - if (nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset)) { + if (nbytes && + (sg = req->src, offset = sg->offset, + nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset))) { void *data; data = kmap_atomic(sg_page(sg)); |