linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO
@ 2019-04-03  9:50 Yue Haibing
  2019-04-03 16:52 ` Al Viro
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yue Haibing @ 2019-04-03  9:50 UTC (permalink / raw)
  To: davem, viro, willemb, edumazet, fw, sagi, hch, pabeni, pctammela
  Cc: linux-kernel, netdev, YueHaibing

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")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 include/linux/skbuff.h | 2 ++
 lib/iov_iter.c         | 2 ++
 net/core/datagram.c    | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9027a8c..3999112 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3396,9 +3396,11 @@ static inline int skb_copy_datagram_msg(const struct sk_buff *from, int offset,
 }
 int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
 				   struct msghdr *msg);
+#ifdef CONFIG_CRYPTO
 int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset,
 			   struct iov_iter *to, int len,
 			   struct ahash_request *hash);
+#endif
 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
 				 struct iov_iter *from, int len);
 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 50e77ec..ed02f74 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1528,6 +1528,7 @@ size_t csum_and_copy_to_iter(const void *addr, size_t bytes, void *csump,
 }
 EXPORT_SYMBOL(csum_and_copy_to_iter);
 
+#ifdef CONFIG_CRYPTO
 size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
 		struct iov_iter *i)
 {
@@ -1542,6 +1543,7 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
 	return copied;
 }
 EXPORT_SYMBOL(hash_and_copy_to_iter);
+#endif
 
 int iov_iter_npages(const struct iov_iter *i, int maxpages)
 {
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 91bb5a0..8815ec2 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -494,6 +494,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 	return 0;
 }
 
+#ifdef CONFIG_CRYPTO
 /**
  *	skb_copy_and_hash_datagram_iter - Copy datagram to an iovec iterator
  *          and update a hash.
@@ -511,6 +512,7 @@ int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset,
 			hash_and_copy_to_iter, hash);
 }
 EXPORT_SYMBOL(skb_copy_and_hash_datagram_iter);
+#endif
 
 static size_t simple_copy_to_iter(const void *addr, size_t bytes,
 		void *data __always_unused, struct iov_iter *i)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-03  9:50 [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO Yue Haibing
@ 2019-04-03 16:52 ` Al Viro
  2019-04-03 21:13   ` Sagi Grimberg
  2019-04-04  2:18   ` YueHaibing
  2019-04-04  2:31 ` [PATCH v2] " Yue Haibing
  2019-04-04  2:39 ` Yue Haibing
  2 siblings, 2 replies; 8+ messages in thread
From: Al Viro @ 2019-04-03 16:52 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, willemb, edumazet, fw, sagi, hch, pabeni, pctammela,
	linux-kernel, netdev

On Wed, Apr 03, 2019 at 05:50:31PM +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")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

I'm not sure it's the right fix; might be better to have something like

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;

        copied = copy_to_iter(addr, bytes, i);
        sg_init_one(&sg, addr, copied);
        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);

instead.  Objections?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-03 16:52 ` Al Viro
@ 2019-04-03 21:13   ` Sagi Grimberg
  2019-04-04  2:18   ` YueHaibing
  1 sibling, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2019-04-03 21:13 UTC (permalink / raw)
  To: Al Viro, Yue Haibing
  Cc: davem, willemb, edumazet, fw, hch, pabeni, pctammela,
	linux-kernel, netdev


>> 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")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> I'm not sure it's the right fix; might be better to have something like
> 
> 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;
> 
>          copied = copy_to_iter(addr, bytes, i);
>          sg_init_one(&sg, addr, copied);
>          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);
> 
> instead.  Objections?

Looks better to me.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-03 16:52 ` Al Viro
  2019-04-03 21:13   ` Sagi Grimberg
@ 2019-04-04  2:18   ` YueHaibing
  1 sibling, 0 replies; 8+ messages in thread
From: YueHaibing @ 2019-04-04  2:18 UTC (permalink / raw)
  To: Al Viro
  Cc: davem, willemb, edumazet, fw, sagi, hch, pabeni, pctammela,
	linux-kernel, netdev



On 2019/4/4 0:52, Al Viro wrote:
> On Wed, Apr 03, 2019 at 05:50:31PM +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")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> 
> I'm not sure it's the right fix; might be better to have something like
> 
> 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;
> 
>         copied = copy_to_iter(addr, bytes, i);
>         sg_init_one(&sg, addr, copied);
>         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);
> 
> instead.  Objections?

Indeed, this seems better. I can post v2 as your suggestion.

> 
> .
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-03  9:50 [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO Yue Haibing
  2019-04-03 16:52 ` Al Viro
@ 2019-04-04  2:31 ` Yue Haibing
  2019-04-04  2:38   ` Al Viro
  2019-04-04  2:40   ` YueHaibing
  2019-04-04  2:39 ` Yue Haibing
  2 siblings, 2 replies; 8+ messages in thread
From: Yue Haibing @ 2019-04-04  2:31 UTC (permalink / raw)
  To: davem, viro, willemb, edumazet, fw, sagi, hch, pabeni, pctammela
  Cc: linux-kernel, netdev, YueHaibing

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);
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-04  2:31 ` [PATCH v2] " Yue Haibing
@ 2019-04-04  2:38   ` Al Viro
  2019-04-04  2:40   ` YueHaibing
  1 sibling, 0 replies; 8+ messages in thread
From: Al Viro @ 2019-04-04  2:38 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, willemb, edumazet, fw, sagi, hch, pabeni, pctammela,
	linux-kernel, netdev

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-03  9:50 [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO Yue Haibing
  2019-04-03 16:52 ` Al Viro
  2019-04-04  2:31 ` [PATCH v2] " Yue Haibing
@ 2019-04-04  2:39 ` Yue Haibing
  2 siblings, 0 replies; 8+ messages in thread
From: Yue Haibing @ 2019-04-04  2:39 UTC (permalink / raw)
  To: davem, viro, willemb, edumazet, fw, sagi, hch, pabeni, pctammela
  Cc: linux-kernel, netdev, YueHaibing

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>
---
v2: rework the fix as Al Viro suggested
---
 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);
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] iov_iter: Fix build error without CONFIG_CRYPTO
  2019-04-04  2:31 ` [PATCH v2] " Yue Haibing
  2019-04-04  2:38   ` Al Viro
@ 2019-04-04  2:40   ` YueHaibing
  1 sibling, 0 replies; 8+ messages in thread
From: YueHaibing @ 2019-04-04  2:40 UTC (permalink / raw)
  To: davem, viro, willemb, edumazet, fw, sagi, hch, pabeni, pctammela
  Cc: linux-kernel, netdev

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);
>  
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-04  2:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03  9:50 [PATCH] iov_iter: Fix build error without CONFIG_CRYPTO Yue Haibing
2019-04-03 16:52 ` Al Viro
2019-04-03 21:13   ` Sagi Grimberg
2019-04-04  2:18   ` YueHaibing
2019-04-04  2:31 ` [PATCH v2] " Yue Haibing
2019-04-04  2:38   ` Al Viro
2019-04-04  2:40   ` YueHaibing
2019-04-04  2:39 ` Yue Haibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).