summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-04-04 10:31:14 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-10 18:36:08 +0200
commit9680a806201d763b9f662b21f28570df7df56d88 (patch)
tree5bd3e625eed1904005ed3d1e122aaf4ce5e8c321 /lib
parent2e94d4e8f2b9ea26e933b8cd1fef5b4b7a3f23db (diff)
iov_iter: Fix build error without CONFIG_CRYPTO
[ Upstream commit 27fad74a5a77fe2e1f876db7bf27efcf2ec304b2 ] If CONFIG_CRYPTO is not set or set to m, gcc building warn this: lib/iov_iter.o: In function `hash_and_copy_to_iter': iov_iter.c:(.text+0x9129): undefined reference to `crypto_stats_get' iov_iter.c:(.text+0x9152): undefined reference to `crypto_stats_ahash_update' Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: d05f443554b3 ("iov_iter: introduce hash_and_copy_to_iter helper") Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/iov_iter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index be4bd627caf0..a0d1cd88f903 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1515,6 +1515,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter);
size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
struct iov_iter *i)
{
+#ifdef CONFIG_CRYPTO
struct ahash_request *hash = hashp;
struct scatterlist sg;
size_t copied;
@@ -1524,6 +1525,9 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
ahash_request_set_crypt(hash, &sg, NULL, copied);
crypto_ahash_update(hash);
return copied;
+#else
+ return 0;
+#endif
}
EXPORT_SYMBOL(hash_and_copy_to_iter);