]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.15/iov_iter-fix-build-error-without-config_crypto.patch
Linux 4.19.42
[thirdparty/kernel/stable-queue.git] / releases / 5.0.15 / iov_iter-fix-build-error-without-config_crypto.patch
1 From d4feed11bef9ea86855bc91da9925c6ef24e122a Mon Sep 17 00:00:00 2001
2 From: YueHaibing <yuehaibing@huawei.com>
3 Date: Thu, 4 Apr 2019 10:31:14 +0800
4 Subject: iov_iter: Fix build error without CONFIG_CRYPTO
5
6 [ Upstream commit 27fad74a5a77fe2e1f876db7bf27efcf2ec304b2 ]
7
8 If CONFIG_CRYPTO is not set or set to m,
9 gcc building warn this:
10
11 lib/iov_iter.o: In function `hash_and_copy_to_iter':
12 iov_iter.c:(.text+0x9129): undefined reference to `crypto_stats_get'
13 iov_iter.c:(.text+0x9152): undefined reference to `crypto_stats_ahash_update'
14
15 Reported-by: Hulk Robot <hulkci@huawei.com>
16 Fixes: d05f443554b3 ("iov_iter: introduce hash_and_copy_to_iter helper")
17 Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
18 Signed-off-by: YueHaibing <yuehaibing@huawei.com>
19 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
21 ---
22 lib/iov_iter.c | 4 ++++
23 1 file changed, 4 insertions(+)
24
25 diff --git a/lib/iov_iter.c b/lib/iov_iter.c
26 index be4bd627caf06..a0d1cd88f903f 100644
27 --- a/lib/iov_iter.c
28 +++ b/lib/iov_iter.c
29 @@ -1515,6 +1515,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter);
30 size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
31 struct iov_iter *i)
32 {
33 +#ifdef CONFIG_CRYPTO
34 struct ahash_request *hash = hashp;
35 struct scatterlist sg;
36 size_t copied;
37 @@ -1524,6 +1525,9 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
38 ahash_request_set_crypt(hash, &sg, NULL, copied);
39 crypto_ahash_update(hash);
40 return copied;
41 +#else
42 + return 0;
43 +#endif
44 }
45 EXPORT_SYMBOL(hash_and_copy_to_iter);
46
47 --
48 2.20.1
49