Skip to content

Commit 27fad74

Browse files
YueHaibingAl Viro
authored andcommitted
iov_iter: Fix build error without CONFIG_CRYPTO
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: d05f443 ("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>
1 parent 18bfb9c commit 27fad74

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/iov_iter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter);
15281528
size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
15291529
struct iov_iter *i)
15301530
{
1531+
#ifdef CONFIG_CRYPTO
15311532
struct ahash_request *hash = hashp;
15321533
struct scatterlist sg;
15331534
size_t copied;
@@ -1537,6 +1538,9 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
15371538
ahash_request_set_crypt(hash, &sg, NULL, copied);
15381539
crypto_ahash_update(hash);
15391540
return copied;
1541+
#else
1542+
return 0;
1543+
#endif
15401544
}
15411545
EXPORT_SYMBOL(hash_and_copy_to_iter);
15421546

0 commit comments

Comments
 (0)