diff options
author | James Morris <james.l.morris@oracle.com> | 2017-11-29 12:47:41 +1100 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-11-29 12:47:41 +1100 |
commit | a43a1243adfa8cc682fd4dacab89910865c28031 (patch) | |
tree | 7aef00d973ddaeace8916dca0d2a5b5b33cd28de /crypto/shash.c | |
parent | f960b5ebd9ed09bc12e10c712bce82ab58ef0435 (diff) | |
parent | 65cb3654889e0b748abc7756260ca267705aee14 (diff) | |
download | linux-crypto-a43a1243adfa8cc682fd4dacab89910865c28031.tar.gz linux-crypto-a43a1243adfa8cc682fd4dacab89910865c28031.zip |
Merge tag 'v4.15-rc1' into next-seccomp
Linux 4.15-rc1
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)); |