summaryrefslogtreecommitdiff
path: root/crypto/shash.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2017-11-13 10:24:50 +0100
committerJuergen Gross <jgross@suse.com>2017-11-13 10:24:50 +0100
commit40248a5f572a9ee5602fb61b33ddcc7de3b4cf5b (patch)
treeb443b237fa80f2cc8ca8510b63aaa4861ba3ea7a /crypto/shash.c
parent4f673910a79f5cb0e7dd87bf807eebb24834cea3 (diff)
parent37d98457e3c414a1673bf5dce97eb4c79b5cff25 (diff)
downloadlinux-crypto-40248a5f572a9ee5602fb61b33ddcc7de3b4cf5b.tar.gz
linux-crypto-40248a5f572a9ee5602fb61b33ddcc7de3b4cf5b.zip
Merge tag 'v4.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Linux 4.14
Diffstat (limited to 'crypto/shash.c')
-rw-r--r--crypto/shash.c10
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));