linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Sagi Grimberg <sagi@lightbitslabs.com>,
	Christoph Hellwig <hch@lst.de>,
	"David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
Date: Thu, 11 Jun 2020 17:43:32 +1000	[thread overview]
Message-ID: <20200611074332.GA12274@gondor.apana.org.au> (raw)

The header file linux/uio.h includes crypto/hash.h which pulls in
most of the Crypto API.  Since linux/uio.h is used throughout the
kernel this means that every tiny bit of change to the Crypto API
causes the entire kernel to get rebuilt.

This patch fixes this by moving it into lib/iov_iter.c instead
where it is actually used.

This patch also fixes the ifdef to use CRYPTO_HASH instead of just
CRYPTO which does not guarantee the existence of ahash.

Finally the prototype of the function has been changed to avoid
the unnecessary use of a void pointer.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/uio.h b/include/linux/uio.h
index 9576fd8158d7..67a8ffd31ad8 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -7,9 +7,9 @@
 
 #include <linux/kernel.h>
 #include <linux/thread_info.h>
-#include <crypto/hash.h>
 #include <uapi/linux/uio.h>
 
+struct ahash_request;
 struct page;
 struct pipe_inode_info;
 
@@ -264,7 +264,7 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
 size_t csum_and_copy_to_iter(const void *addr, size_t bytes, void *csump, struct iov_iter *i);
 size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
 bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
-size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
+size_t hash_and_copy_to_iter(const void *addr, size_t bytes, struct ahash_request *hash,
 		struct iov_iter *i);
 
 ssize_t import_iovec(int type, const struct iovec __user * uvector,
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 51595bf3af85..ac537111dcc6 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
+#include <crypto/hash.h>
 #include <linux/export.h>
 #include <linux/bvec.h>
 #include <linux/uio.h>
@@ -1563,11 +1564,10 @@ size_t csum_and_copy_to_iter(const void *addr, size_t bytes, void *csump,
 }
 EXPORT_SYMBOL(csum_and_copy_to_iter);
 
-size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
+size_t hash_and_copy_to_iter(const void *addr, size_t bytes, struct ahash_request *hash,
 		struct iov_iter *i)
 {
-#ifdef CONFIG_CRYPTO
-	struct ahash_request *hash = hashp;
+#ifdef CONFIG_CRYPTO_HASH
 	struct scatterlist sg;
 	size_t copied;
 
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

             reply	other threads:[~2020-06-11  7:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  7:43 Herbert Xu [this message]
2020-06-11  7:56 ` [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
2020-06-11 10:48 ` kernel test robot
2020-06-11 10:51 ` kernel test robot
2020-06-11 10:51 ` kernel test robot
2020-06-11 10:53 ` kernel test robot
2020-06-11 11:49 ` [v2 PATCH] " Herbert Xu
2020-06-12  6:57   ` [v3 " Herbert Xu
2020-06-15  7:09     ` Christoph Hellwig
2020-06-15 14:16     ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611074332.GA12274@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagi@lightbitslabs.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).