diff mbox series

[v2] iov_iter: Fix build error without CONFIG_CRYPTO

Message ID 20190404023114.30304-1-yuehaibing@huawei.com
State Not Applicable
Delegated to: David Miller
Headers show
Series [v2] iov_iter: Fix build error without CONFIG_CRYPTO | expand

Commit Message

Yue Haibing April 4, 2019, 2:31 a.m. UTC
From: YueHaibing <yuehaibing@huawei.com>

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>
---
---
 lib/iov_iter.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Al Viro April 4, 2019, 2:38 a.m. UTC | #1
On Thu, Apr 04, 2019 at 10:31:14AM +0800, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> 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>

Applied.
Yue Haibing April 4, 2019, 2:40 a.m. UTC | #2
Pls ignore this, sorry.

On 2019/4/4 10:31, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> 
> 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>
> ---
> ---
>  lib/iov_iter.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index 50e77ec..f74fa83 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -1531,6 +1531,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;
> @@ -1540,6 +1541,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);
>  
>
diff mbox series

Patch

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 50e77ec..f74fa83 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1531,6 +1531,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;
@@ -1540,6 +1541,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);