* [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
@ 2020-06-11 7:43 Herbert Xu
2020-06-11 7:56 ` Herbert Xu
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Herbert Xu @ 2020-06-11 7:43 UTC (permalink / raw)
To: Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
@ 2020-06-11 7:56 ` Herbert Xu
2020-06-11 10:48 ` kernel test robot
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2020-06-11 7:56 UTC (permalink / raw)
To: Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
On Thu, Jun 11, 2020 at 05:43:32PM +1000, Herbert Xu wrote:
>
> Finally the prototype of the function has been changed to avoid
> the unnecessary use of a void pointer.
OK that doesn't quite work. Let me respin without it and instead
add some missing inclusions of crypto/hash.h in files that were
wrongly relying on uio.h to include it.
Cheers,
--
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
2020-06-11 7:56 ` Herbert Xu
@ 2020-06-11 10:48 ` kernel test robot
2020-06-11 10:51 ` kernel test robot
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-06-11 10:48 UTC (permalink / raw)
To: Herbert Xu, Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 16242 bytes --]
Hi Herbert,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/iov_iter-Move-unnecessary-inclusion-of-crypto-hash-h/20200611-154742
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: c6x-allyesconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/soc/qcom/pdr_interface.c: In function 'pdr_indack_work':
>> drivers/soc/qcom/pdr_interface.c:292:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
292 | kfree(ind);
| ^~~~~
drivers/soc/qcom/pdr_interface.c: In function 'pdr_indication_cb':
>> drivers/soc/qcom/pdr_interface.c:328:8: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
328 | ind = kzalloc(sizeof(*ind), GFP_KERNEL);
| ^~~~~~~
>> drivers/soc/qcom/pdr_interface.c:328:6: warning: assignment to 'struct pdr_list_node *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
328 | ind = kzalloc(sizeof(*ind), GFP_KERNEL);
| ^
drivers/soc/qcom/pdr_interface.c: In function 'pdr_locate_service':
>> drivers/soc/qcom/pdr_interface.c:401:7: warning: assignment to 'struct servreg_get_domain_list_resp *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
401 | resp = kzalloc(sizeof(*resp), GFP_KERNEL);
| ^
drivers/soc/qcom/pdr_interface.c: In function 'pdr_add_lookup':
>> drivers/soc/qcom/pdr_interface.c:526:6: warning: assignment to 'struct pdr_service *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
526 | pds = kzalloc(sizeof(*pds), GFP_KERNEL);
| ^
drivers/soc/qcom/pdr_interface.c: In function 'pdr_handle_alloc':
>> drivers/soc/qcom/pdr_interface.c:656:6: warning: assignment to 'struct pdr_handle *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
656 | pdr = kzalloc(sizeof(*pdr), GFP_KERNEL);
| ^
cc1: some warnings being treated as errors
vim +/kfree +292 drivers/soc/qcom/pdr_interface.c
fbe639b44a8275 Sibi Sankar 2020-03-12 271
fbe639b44a8275 Sibi Sankar 2020-03-12 272 static void pdr_indack_work(struct work_struct *work)
fbe639b44a8275 Sibi Sankar 2020-03-12 273 {
fbe639b44a8275 Sibi Sankar 2020-03-12 274 struct pdr_handle *pdr = container_of(work, struct pdr_handle,
fbe639b44a8275 Sibi Sankar 2020-03-12 275 indack_work);
fbe639b44a8275 Sibi Sankar 2020-03-12 276 struct pdr_list_node *ind, *tmp;
fbe639b44a8275 Sibi Sankar 2020-03-12 277 struct pdr_service *pds;
fbe639b44a8275 Sibi Sankar 2020-03-12 278
fbe639b44a8275 Sibi Sankar 2020-03-12 279 list_for_each_entry_safe(ind, tmp, &pdr->indack_list, node) {
fbe639b44a8275 Sibi Sankar 2020-03-12 280 pds = ind->pds;
fbe639b44a8275 Sibi Sankar 2020-03-12 281 pdr_send_indack_msg(pdr, pds, ind->transaction_id);
fbe639b44a8275 Sibi Sankar 2020-03-12 282
fbe639b44a8275 Sibi Sankar 2020-03-12 283 mutex_lock(&pdr->status_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 284 pds->state = ind->curr_state;
fbe639b44a8275 Sibi Sankar 2020-03-12 285 pdr->status(pds->state, pds->service_path, pdr->priv);
fbe639b44a8275 Sibi Sankar 2020-03-12 286 mutex_unlock(&pdr->status_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 287
fbe639b44a8275 Sibi Sankar 2020-03-12 288 mutex_lock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 289 list_del(&ind->node);
fbe639b44a8275 Sibi Sankar 2020-03-12 290 mutex_unlock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 291
fbe639b44a8275 Sibi Sankar 2020-03-12 @292 kfree(ind);
fbe639b44a8275 Sibi Sankar 2020-03-12 293 }
fbe639b44a8275 Sibi Sankar 2020-03-12 294 }
fbe639b44a8275 Sibi Sankar 2020-03-12 295
fbe639b44a8275 Sibi Sankar 2020-03-12 296 static void pdr_indication_cb(struct qmi_handle *qmi,
fbe639b44a8275 Sibi Sankar 2020-03-12 297 struct sockaddr_qrtr *sq,
fbe639b44a8275 Sibi Sankar 2020-03-12 298 struct qmi_txn *txn, const void *data)
fbe639b44a8275 Sibi Sankar 2020-03-12 299 {
fbe639b44a8275 Sibi Sankar 2020-03-12 300 struct pdr_handle *pdr = container_of(qmi, struct pdr_handle,
fbe639b44a8275 Sibi Sankar 2020-03-12 301 notifier_hdl);
fbe639b44a8275 Sibi Sankar 2020-03-12 302 const struct servreg_state_updated_ind *ind_msg = data;
fbe639b44a8275 Sibi Sankar 2020-03-12 303 struct pdr_list_node *ind;
fbe639b44a8275 Sibi Sankar 2020-03-12 304 struct pdr_service *pds;
e69b3bede1b2f7 Nathan Chancellor 2020-03-16 305 bool found = false;
fbe639b44a8275 Sibi Sankar 2020-03-12 306
fbe639b44a8275 Sibi Sankar 2020-03-12 307 if (!ind_msg || !ind_msg->service_path[0] ||
fbe639b44a8275 Sibi Sankar 2020-03-12 308 strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH)
fbe639b44a8275 Sibi Sankar 2020-03-12 309 return;
fbe639b44a8275 Sibi Sankar 2020-03-12 310
fbe639b44a8275 Sibi Sankar 2020-03-12 311 mutex_lock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 312 list_for_each_entry(pds, &pdr->lookups, node) {
fbe639b44a8275 Sibi Sankar 2020-03-12 313 if (strcmp(pds->service_path, ind_msg->service_path))
fbe639b44a8275 Sibi Sankar 2020-03-12 314 continue;
fbe639b44a8275 Sibi Sankar 2020-03-12 315
fbe639b44a8275 Sibi Sankar 2020-03-12 316 found = true;
fbe639b44a8275 Sibi Sankar 2020-03-12 317 break;
fbe639b44a8275 Sibi Sankar 2020-03-12 318 }
fbe639b44a8275 Sibi Sankar 2020-03-12 319 mutex_unlock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 320
fbe639b44a8275 Sibi Sankar 2020-03-12 321 if (!found)
fbe639b44a8275 Sibi Sankar 2020-03-12 322 return;
fbe639b44a8275 Sibi Sankar 2020-03-12 323
fbe639b44a8275 Sibi Sankar 2020-03-12 324 pr_info("PDR: Indication received from %s, state: 0x%x, trans-id: %d\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 325 ind_msg->service_path, ind_msg->curr_state,
fbe639b44a8275 Sibi Sankar 2020-03-12 326 ind_msg->transaction_id);
fbe639b44a8275 Sibi Sankar 2020-03-12 327
fbe639b44a8275 Sibi Sankar 2020-03-12 @328 ind = kzalloc(sizeof(*ind), GFP_KERNEL);
fbe639b44a8275 Sibi Sankar 2020-03-12 329 if (!ind)
fbe639b44a8275 Sibi Sankar 2020-03-12 330 return;
fbe639b44a8275 Sibi Sankar 2020-03-12 331
fbe639b44a8275 Sibi Sankar 2020-03-12 332 ind->transaction_id = ind_msg->transaction_id;
fbe639b44a8275 Sibi Sankar 2020-03-12 333 ind->curr_state = ind_msg->curr_state;
fbe639b44a8275 Sibi Sankar 2020-03-12 334 ind->pds = pds;
fbe639b44a8275 Sibi Sankar 2020-03-12 335
fbe639b44a8275 Sibi Sankar 2020-03-12 336 mutex_lock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 337 list_add_tail(&ind->node, &pdr->indack_list);
fbe639b44a8275 Sibi Sankar 2020-03-12 338 mutex_unlock(&pdr->list_lock);
fbe639b44a8275 Sibi Sankar 2020-03-12 339
fbe639b44a8275 Sibi Sankar 2020-03-12 340 queue_work(pdr->indack_wq, &pdr->indack_work);
fbe639b44a8275 Sibi Sankar 2020-03-12 341 }
fbe639b44a8275 Sibi Sankar 2020-03-12 342
fbe639b44a8275 Sibi Sankar 2020-03-12 343 static struct qmi_msg_handler qmi_indication_handler[] = {
fbe639b44a8275 Sibi Sankar 2020-03-12 344 {
fbe639b44a8275 Sibi Sankar 2020-03-12 345 .type = QMI_INDICATION,
fbe639b44a8275 Sibi Sankar 2020-03-12 346 .msg_id = SERVREG_STATE_UPDATED_IND_ID,
fbe639b44a8275 Sibi Sankar 2020-03-12 347 .ei = servreg_state_updated_ind_ei,
fbe639b44a8275 Sibi Sankar 2020-03-12 348 .decoded_size = sizeof(struct servreg_state_updated_ind),
fbe639b44a8275 Sibi Sankar 2020-03-12 349 .fn = pdr_indication_cb,
fbe639b44a8275 Sibi Sankar 2020-03-12 350 },
fbe639b44a8275 Sibi Sankar 2020-03-12 351 {}
fbe639b44a8275 Sibi Sankar 2020-03-12 352 };
fbe639b44a8275 Sibi Sankar 2020-03-12 353
fbe639b44a8275 Sibi Sankar 2020-03-12 354 static int pdr_get_domain_list(struct servreg_get_domain_list_req *req,
fbe639b44a8275 Sibi Sankar 2020-03-12 355 struct servreg_get_domain_list_resp *resp,
fbe639b44a8275 Sibi Sankar 2020-03-12 356 struct pdr_handle *pdr)
fbe639b44a8275 Sibi Sankar 2020-03-12 357 {
fbe639b44a8275 Sibi Sankar 2020-03-12 358 struct qmi_txn txn;
fbe639b44a8275 Sibi Sankar 2020-03-12 359 int ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 360
fbe639b44a8275 Sibi Sankar 2020-03-12 361 ret = qmi_txn_init(&pdr->locator_hdl, &txn,
fbe639b44a8275 Sibi Sankar 2020-03-12 362 servreg_get_domain_list_resp_ei, resp);
fbe639b44a8275 Sibi Sankar 2020-03-12 363 if (ret < 0)
fbe639b44a8275 Sibi Sankar 2020-03-12 364 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 365
fbe639b44a8275 Sibi Sankar 2020-03-12 366 ret = qmi_send_request(&pdr->locator_hdl,
fbe639b44a8275 Sibi Sankar 2020-03-12 367 &pdr->locator_addr,
fbe639b44a8275 Sibi Sankar 2020-03-12 368 &txn, SERVREG_GET_DOMAIN_LIST_REQ,
fbe639b44a8275 Sibi Sankar 2020-03-12 369 SERVREG_GET_DOMAIN_LIST_REQ_MAX_LEN,
fbe639b44a8275 Sibi Sankar 2020-03-12 370 servreg_get_domain_list_req_ei,
fbe639b44a8275 Sibi Sankar 2020-03-12 371 req);
fbe639b44a8275 Sibi Sankar 2020-03-12 372 if (ret < 0) {
fbe639b44a8275 Sibi Sankar 2020-03-12 373 qmi_txn_cancel(&txn);
fbe639b44a8275 Sibi Sankar 2020-03-12 374 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 375 }
fbe639b44a8275 Sibi Sankar 2020-03-12 376
fbe639b44a8275 Sibi Sankar 2020-03-12 377 ret = qmi_txn_wait(&txn, 5 * HZ);
fbe639b44a8275 Sibi Sankar 2020-03-12 378 if (ret < 0) {
fbe639b44a8275 Sibi Sankar 2020-03-12 379 pr_err("PDR: %s get domain list txn wait failed: %d\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 380 req->service_name, ret);
fbe639b44a8275 Sibi Sankar 2020-03-12 381 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 382 }
fbe639b44a8275 Sibi Sankar 2020-03-12 383
fbe639b44a8275 Sibi Sankar 2020-03-12 384 if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
fbe639b44a8275 Sibi Sankar 2020-03-12 385 pr_err("PDR: %s get domain list failed: 0x%x\n",
fbe639b44a8275 Sibi Sankar 2020-03-12 386 req->service_name, resp->resp.error);
fbe639b44a8275 Sibi Sankar 2020-03-12 387 return -EREMOTEIO;
fbe639b44a8275 Sibi Sankar 2020-03-12 388 }
fbe639b44a8275 Sibi Sankar 2020-03-12 389
fbe639b44a8275 Sibi Sankar 2020-03-12 390 return 0;
fbe639b44a8275 Sibi Sankar 2020-03-12 391 }
fbe639b44a8275 Sibi Sankar 2020-03-12 392
fbe639b44a8275 Sibi Sankar 2020-03-12 393 static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
fbe639b44a8275 Sibi Sankar 2020-03-12 394 {
fbe639b44a8275 Sibi Sankar 2020-03-12 395 struct servreg_get_domain_list_resp *resp;
fbe639b44a8275 Sibi Sankar 2020-03-12 396 struct servreg_get_domain_list_req req;
fbe639b44a8275 Sibi Sankar 2020-03-12 397 struct servreg_location_entry *entry;
fbe639b44a8275 Sibi Sankar 2020-03-12 398 int domains_read = 0;
fbe639b44a8275 Sibi Sankar 2020-03-12 399 int ret, i;
fbe639b44a8275 Sibi Sankar 2020-03-12 400
fbe639b44a8275 Sibi Sankar 2020-03-12 @401 resp = kzalloc(sizeof(*resp), GFP_KERNEL);
fbe639b44a8275 Sibi Sankar 2020-03-12 402 if (!resp)
fbe639b44a8275 Sibi Sankar 2020-03-12 403 return -ENOMEM;
fbe639b44a8275 Sibi Sankar 2020-03-12 404
fbe639b44a8275 Sibi Sankar 2020-03-12 405 /* Prepare req message */
fbe639b44a8275 Sibi Sankar 2020-03-12 406 strcpy(req.service_name, pds->service_name);
fbe639b44a8275 Sibi Sankar 2020-03-12 407 req.domain_offset_valid = true;
fbe639b44a8275 Sibi Sankar 2020-03-12 408 req.domain_offset = 0;
fbe639b44a8275 Sibi Sankar 2020-03-12 409
fbe639b44a8275 Sibi Sankar 2020-03-12 410 do {
fbe639b44a8275 Sibi Sankar 2020-03-12 411 req.domain_offset = domains_read;
fbe639b44a8275 Sibi Sankar 2020-03-12 412 ret = pdr_get_domain_list(&req, resp, pdr);
fbe639b44a8275 Sibi Sankar 2020-03-12 413 if (ret < 0)
fbe639b44a8275 Sibi Sankar 2020-03-12 414 goto out;
fbe639b44a8275 Sibi Sankar 2020-03-12 415
fbe639b44a8275 Sibi Sankar 2020-03-12 416 for (i = domains_read; i < resp->domain_list_len; i++) {
fbe639b44a8275 Sibi Sankar 2020-03-12 417 entry = &resp->domain_list[i];
fbe639b44a8275 Sibi Sankar 2020-03-12 418
fbe639b44a8275 Sibi Sankar 2020-03-12 419 if (strnlen(entry->name, sizeof(entry->name)) == sizeof(entry->name))
fbe639b44a8275 Sibi Sankar 2020-03-12 420 continue;
fbe639b44a8275 Sibi Sankar 2020-03-12 421
fbe639b44a8275 Sibi Sankar 2020-03-12 422 if (!strcmp(entry->name, pds->service_path)) {
fbe639b44a8275 Sibi Sankar 2020-03-12 423 pds->service_data_valid = entry->service_data_valid;
fbe639b44a8275 Sibi Sankar 2020-03-12 424 pds->service_data = entry->service_data;
fbe639b44a8275 Sibi Sankar 2020-03-12 425 pds->instance = entry->instance;
fbe639b44a8275 Sibi Sankar 2020-03-12 426 goto out;
fbe639b44a8275 Sibi Sankar 2020-03-12 427 }
fbe639b44a8275 Sibi Sankar 2020-03-12 428 }
fbe639b44a8275 Sibi Sankar 2020-03-12 429
fbe639b44a8275 Sibi Sankar 2020-03-12 430 /* Update ret to indicate that the service is not yet found */
fbe639b44a8275 Sibi Sankar 2020-03-12 431 ret = -ENXIO;
fbe639b44a8275 Sibi Sankar 2020-03-12 432
fbe639b44a8275 Sibi Sankar 2020-03-12 433 /* Always read total_domains from the response msg */
fbe639b44a8275 Sibi Sankar 2020-03-12 434 if (resp->domain_list_len > resp->total_domains)
fbe639b44a8275 Sibi Sankar 2020-03-12 435 resp->domain_list_len = resp->total_domains;
fbe639b44a8275 Sibi Sankar 2020-03-12 436
fbe639b44a8275 Sibi Sankar 2020-03-12 437 domains_read += resp->domain_list_len;
fbe639b44a8275 Sibi Sankar 2020-03-12 438 } while (domains_read < resp->total_domains);
fbe639b44a8275 Sibi Sankar 2020-03-12 439 out:
fbe639b44a8275 Sibi Sankar 2020-03-12 440 kfree(resp);
fbe639b44a8275 Sibi Sankar 2020-03-12 441 return ret;
fbe639b44a8275 Sibi Sankar 2020-03-12 442 }
fbe639b44a8275 Sibi Sankar 2020-03-12 443
:::::: The code at line 292 was first introduced by commit
:::::: fbe639b44a82755d639df1c5d147c93f02ac5a0f soc: qcom: Introduce Protection Domain Restart helpers
:::::: TO: Sibi Sankar <sibis@codeaurora.org>
:::::: CC: Bjorn Andersson <bjorn.andersson@linaro.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 53390 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
2020-06-11 7:56 ` 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
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-06-11 10:51 UTC (permalink / raw)
To: Herbert Xu, Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 3509 bytes --]
Hi Herbert,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/iov_iter-Move-unnecessary-inclusion-of-crypto-hash-h/20200611-154742
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: x86_64-randconfig-s021-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-250-g42323db3-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> net/core/datagram.c:512:25: sparse: sparse: incorrect type in argument 6 (incompatible argument 3 (different base types)) @@ expected unsigned long ( *cb )( ... ) @@ got unsigned long ( * )( ... ) @@
>> net/core/datagram.c:512:25: sparse: expected unsigned long ( *cb )( ... )
>> net/core/datagram.c:512:25: sparse: got unsigned long ( * )( ... )
include/net/sock.h:1603:31: sparse: sparse: context imbalance in '__skb_free_datagram_locked' - unexpected unlock
vim +512 net/core/datagram.c
950fcaecd5cc6c0 Sagi Grimberg 2018-12-03 497
65d69e2505bb64f Sagi Grimberg 2018-12-03 498 /**
65d69e2505bb64f Sagi Grimberg 2018-12-03 499 * skb_copy_and_hash_datagram_iter - Copy datagram to an iovec iterator
65d69e2505bb64f Sagi Grimberg 2018-12-03 500 * and update a hash.
65d69e2505bb64f Sagi Grimberg 2018-12-03 501 * @skb: buffer to copy
65d69e2505bb64f Sagi Grimberg 2018-12-03 502 * @offset: offset in the buffer to start copying from
65d69e2505bb64f Sagi Grimberg 2018-12-03 503 * @to: iovec iterator to copy to
65d69e2505bb64f Sagi Grimberg 2018-12-03 504 * @len: amount of data to copy from buffer to iovec
65d69e2505bb64f Sagi Grimberg 2018-12-03 505 * @hash: hash request to update
65d69e2505bb64f Sagi Grimberg 2018-12-03 506 */
65d69e2505bb64f Sagi Grimberg 2018-12-03 507 int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset,
65d69e2505bb64f Sagi Grimberg 2018-12-03 508 struct iov_iter *to, int len,
65d69e2505bb64f Sagi Grimberg 2018-12-03 509 struct ahash_request *hash)
65d69e2505bb64f Sagi Grimberg 2018-12-03 510 {
65d69e2505bb64f Sagi Grimberg 2018-12-03 511 return __skb_datagram_iter(skb, offset, to, len, true,
65d69e2505bb64f Sagi Grimberg 2018-12-03 @512 hash_and_copy_to_iter, hash);
65d69e2505bb64f Sagi Grimberg 2018-12-03 513 }
65d69e2505bb64f Sagi Grimberg 2018-12-03 514 EXPORT_SYMBOL(skb_copy_and_hash_datagram_iter);
65d69e2505bb64f Sagi Grimberg 2018-12-03 515
:::::: The code at line 512 was first introduced by commit
:::::: 65d69e2505bb64f6a8d7f417f6e46e2a351174c6 datagram: introduce skb_copy_and_hash_datagram_iter helper
:::::: TO: Sagi Grimberg <sagi@lightbitslabs.com>
:::::: CC: Christoph Hellwig <hch@lst.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27574 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-06-11 10:51 UTC (permalink / raw)
To: Herbert Xu, Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 3486 bytes --]
Hi Herbert,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/iov_iter-Move-unnecessary-inclusion-of-crypto-hash-h/20200611-154742
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: i386-randconfig-s001-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-250-g42323db3-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> net/core/datagram.c:512:25: sparse: sparse: incorrect type in argument 6 (incompatible argument 3 (different base types)) @@ expected unsigned int ( *cb )( ... ) @@ got unsigned int ( * )( ... ) @@
>> net/core/datagram.c:512:25: sparse: expected unsigned int ( *cb )( ... )
>> net/core/datagram.c:512:25: sparse: got unsigned int ( * )( ... )
include/linux/spinlock.h:398:9: sparse: sparse: context imbalance in '__skb_free_datagram_locked' - unexpected unlock
vim +512 net/core/datagram.c
950fcaecd5cc6c Sagi Grimberg 2018-12-03 497
65d69e2505bb64 Sagi Grimberg 2018-12-03 498 /**
65d69e2505bb64 Sagi Grimberg 2018-12-03 499 * skb_copy_and_hash_datagram_iter - Copy datagram to an iovec iterator
65d69e2505bb64 Sagi Grimberg 2018-12-03 500 * and update a hash.
65d69e2505bb64 Sagi Grimberg 2018-12-03 501 * @skb: buffer to copy
65d69e2505bb64 Sagi Grimberg 2018-12-03 502 * @offset: offset in the buffer to start copying from
65d69e2505bb64 Sagi Grimberg 2018-12-03 503 * @to: iovec iterator to copy to
65d69e2505bb64 Sagi Grimberg 2018-12-03 504 * @len: amount of data to copy from buffer to iovec
65d69e2505bb64 Sagi Grimberg 2018-12-03 505 * @hash: hash request to update
65d69e2505bb64 Sagi Grimberg 2018-12-03 506 */
65d69e2505bb64 Sagi Grimberg 2018-12-03 507 int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset,
65d69e2505bb64 Sagi Grimberg 2018-12-03 508 struct iov_iter *to, int len,
65d69e2505bb64 Sagi Grimberg 2018-12-03 509 struct ahash_request *hash)
65d69e2505bb64 Sagi Grimberg 2018-12-03 510 {
65d69e2505bb64 Sagi Grimberg 2018-12-03 511 return __skb_datagram_iter(skb, offset, to, len, true,
65d69e2505bb64 Sagi Grimberg 2018-12-03 @512 hash_and_copy_to_iter, hash);
65d69e2505bb64 Sagi Grimberg 2018-12-03 513 }
65d69e2505bb64 Sagi Grimberg 2018-12-03 514 EXPORT_SYMBOL(skb_copy_and_hash_datagram_iter);
65d69e2505bb64 Sagi Grimberg 2018-12-03 515
:::::: The code at line 512 was first introduced by commit
:::::: 65d69e2505bb64f6a8d7f417f6e46e2a351174c6 datagram: introduce skb_copy_and_hash_datagram_iter helper
:::::: TO: Sagi Grimberg <sagi@lightbitslabs.com>
:::::: CC: Christoph Hellwig <hch@lst.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41966 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-06-11 10:53 UTC (permalink / raw)
To: Herbert Xu, Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 11726 bytes --]
Hi Herbert,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Herbert-Xu/iov_iter-Move-unnecessary-inclusion-of-crypto-hash-h/20200611-154742
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: x86_64-randconfig-m001-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/mtd/mtdpstore.c: In function 'mtdpstore_notify_add':
>> drivers/mtd/mtdpstore.c:419:15: error: implicit declaration of function 'kcalloc' [-Werror=implicit-function-declaration]
419 | cxt->rmmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
| ^~~~~~~
>> drivers/mtd/mtdpstore.c:419:13: warning: assignment to 'long unsigned int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
419 | cxt->rmmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
| ^
drivers/mtd/mtdpstore.c:420:15: warning: assignment to 'long unsigned int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
420 | cxt->usedmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
| ^
drivers/mtd/mtdpstore.c:423:14: warning: assignment to 'long unsigned int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
423 | cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
| ^
drivers/mtd/mtdpstore.c: In function 'mtdpstore_flush_removed_do':
>> drivers/mtd/mtdpstore.c:452:8: error: implicit declaration of function 'kmalloc' [-Werror=implicit-function-declaration]
452 | buf = kmalloc(mtd->erasesize, GFP_KERNEL);
| ^~~~~~~
>> drivers/mtd/mtdpstore.c:452:6: warning: assignment to 'u_char *' {aka 'unsigned char *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
452 | buf = kmalloc(mtd->erasesize, GFP_KERNEL);
| ^
>> drivers/mtd/mtdpstore.c:485:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]
485 | kfree(buf);
| ^~~~~
cc1: some warnings being treated as errors
--
drivers/dma/sf-pdma/sf-pdma.c: In function 'sf_pdma_alloc_desc':
>> drivers/dma/sf-pdma/sf-pdma.c:65:9: error: implicit declaration of function 'kzalloc'; did you mean 'vzalloc'? [-Werror=implicit-function-declaration]
65 | desc = kzalloc(sizeof(*desc), GFP_NOWAIT);
| ^~~~~~~
| vzalloc
>> drivers/dma/sf-pdma/sf-pdma.c:65:7: warning: assignment to 'struct sf_pdma_desc *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
65 | desc = kzalloc(sizeof(*desc), GFP_NOWAIT);
| ^
drivers/dma/sf-pdma/sf-pdma.c: In function 'sf_pdma_free_chan_resources':
>> drivers/dma/sf-pdma/sf-pdma.c:155:2: error: implicit declaration of function 'kfree'; did you mean 'vfree'? [-Werror=implicit-function-declaration]
155 | kfree(chan->desc);
| ^~~~~
| vfree
cc1: some warnings being treated as errors
vim +/kcalloc +419 drivers/mtd/mtdpstore.c
78c08247b9d3e0 WeiXiong Liao 2020-03-25 379
78c08247b9d3e0 WeiXiong Liao 2020-03-25 380 static void mtdpstore_notify_add(struct mtd_info *mtd)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 381 {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 382 int ret;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 383 struct mtdpstore_context *cxt = &oops_cxt;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 384 struct pstore_blk_config *info = &cxt->info;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 385 unsigned long longcnt;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 386
78c08247b9d3e0 WeiXiong Liao 2020-03-25 387 if (!strcmp(mtd->name, info->device))
78c08247b9d3e0 WeiXiong Liao 2020-03-25 388 cxt->index = mtd->index;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 389
78c08247b9d3e0 WeiXiong Liao 2020-03-25 390 if (mtd->index != cxt->index || cxt->index < 0)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 391 return;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 392
78c08247b9d3e0 WeiXiong Liao 2020-03-25 393 dev_dbg(&mtd->dev, "found matching MTD device %s\n", mtd->name);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 394
78c08247b9d3e0 WeiXiong Liao 2020-03-25 395 if (mtd->size < info->kmsg_size * 2) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 396 dev_err(&mtd->dev, "MTD partition %d not big enough\n",
78c08247b9d3e0 WeiXiong Liao 2020-03-25 397 mtd->index);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 398 return;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 399 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 400 /*
78c08247b9d3e0 WeiXiong Liao 2020-03-25 401 * kmsg_size must be aligned to 4096 Bytes, which is limited by
78c08247b9d3e0 WeiXiong Liao 2020-03-25 402 * psblk. The default value of kmsg_size is 64KB. If kmsg_size
78c08247b9d3e0 WeiXiong Liao 2020-03-25 403 * is larger than erasesize, some errors will occur since mtdpsotre
78c08247b9d3e0 WeiXiong Liao 2020-03-25 404 * is designed on it.
78c08247b9d3e0 WeiXiong Liao 2020-03-25 405 */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 406 if (mtd->erasesize < info->kmsg_size) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 407 dev_err(&mtd->dev, "eraseblock size of MTD partition %d too small\n",
78c08247b9d3e0 WeiXiong Liao 2020-03-25 408 mtd->index);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 409 return;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 410 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 411 if (unlikely(info->kmsg_size % mtd->writesize)) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 412 dev_err(&mtd->dev, "record size %lu KB must align to write size %d KB\n",
78c08247b9d3e0 WeiXiong Liao 2020-03-25 413 info->kmsg_size / 1024,
78c08247b9d3e0 WeiXiong Liao 2020-03-25 414 mtd->writesize / 1024);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 415 return;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 416 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 417
78c08247b9d3e0 WeiXiong Liao 2020-03-25 418 longcnt = BITS_TO_LONGS(div_u64(mtd->size, info->kmsg_size));
78c08247b9d3e0 WeiXiong Liao 2020-03-25 @419 cxt->rmmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 420 cxt->usedmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 421
78c08247b9d3e0 WeiXiong Liao 2020-03-25 422 longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize));
78c08247b9d3e0 WeiXiong Liao 2020-03-25 423 cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 424
78c08247b9d3e0 WeiXiong Liao 2020-03-25 425 cxt->dev.total_size = mtd->size;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 426 /* just support dmesg right now */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 427 cxt->dev.flags = PSTORE_FLAGS_DMESG;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 428 cxt->dev.read = mtdpstore_read;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 429 cxt->dev.write = mtdpstore_write;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 430 cxt->dev.erase = mtdpstore_erase;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 431 cxt->dev.panic_write = mtdpstore_panic_write;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 432
78c08247b9d3e0 WeiXiong Liao 2020-03-25 433 ret = register_pstore_device(&cxt->dev);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 434 if (ret) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 435 dev_err(&mtd->dev, "mtd%d register to psblk failed\n",
78c08247b9d3e0 WeiXiong Liao 2020-03-25 436 mtd->index);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 437 return;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 438 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 439 cxt->mtd = mtd;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 440 dev_info(&mtd->dev, "Attached to MTD device %d\n", mtd->index);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 441 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 442
78c08247b9d3e0 WeiXiong Liao 2020-03-25 443 static int mtdpstore_flush_removed_do(struct mtdpstore_context *cxt,
78c08247b9d3e0 WeiXiong Liao 2020-03-25 444 loff_t off, size_t size)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 445 {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 446 struct mtd_info *mtd = cxt->mtd;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 447 u_char *buf;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 448 int ret;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 449 size_t retlen;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 450 struct erase_info erase;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 451
78c08247b9d3e0 WeiXiong Liao 2020-03-25 @452 buf = kmalloc(mtd->erasesize, GFP_KERNEL);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 453 if (!buf)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 454 return -ENOMEM;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 455
78c08247b9d3e0 WeiXiong Liao 2020-03-25 456 /* 1st. read to cache */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 457 ret = mtd_read(mtd, off, mtd->erasesize, &retlen, buf);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 458 if (mtdpstore_is_io_error(ret))
78c08247b9d3e0 WeiXiong Liao 2020-03-25 459 goto free;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 460
78c08247b9d3e0 WeiXiong Liao 2020-03-25 461 /* 2nd. erase block */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 462 erase.len = mtd->erasesize;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 463 erase.addr = off;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 464 ret = mtd_erase(mtd, &erase);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 465 if (ret)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 466 goto free;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 467
78c08247b9d3e0 WeiXiong Liao 2020-03-25 468 /* 3rd. write back */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 469 while (size) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 470 unsigned int zonesize = cxt->info.kmsg_size;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 471
78c08247b9d3e0 WeiXiong Liao 2020-03-25 472 /* there is valid data on block, write back */
78c08247b9d3e0 WeiXiong Liao 2020-03-25 473 if (mtdpstore_is_used(cxt, off)) {
78c08247b9d3e0 WeiXiong Liao 2020-03-25 474 ret = mtd_write(mtd, off, zonesize, &retlen, buf);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 475 if (ret)
78c08247b9d3e0 WeiXiong Liao 2020-03-25 476 dev_err(&mtd->dev, "write failure at %lld (%zu of %u written), err %d\n",
78c08247b9d3e0 WeiXiong Liao 2020-03-25 477 off, retlen, zonesize, ret);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 478 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 479
78c08247b9d3e0 WeiXiong Liao 2020-03-25 480 off += zonesize;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 481 size -= min_t(unsigned int, zonesize, size);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 482 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 483
78c08247b9d3e0 WeiXiong Liao 2020-03-25 484 free:
78c08247b9d3e0 WeiXiong Liao 2020-03-25 @485 kfree(buf);
78c08247b9d3e0 WeiXiong Liao 2020-03-25 486 return ret;
78c08247b9d3e0 WeiXiong Liao 2020-03-25 487 }
78c08247b9d3e0 WeiXiong Liao 2020-03-25 488
:::::: The code at line 419 was first introduced by commit
:::::: 78c08247b9d3e03192f8b359aa079024e805a948 mtd: Support kmsg dumper based on pstore/blk
:::::: TO: WeiXiong Liao <liaoweixiong@allwinnertech.com>
:::::: CC: Kees Cook <keescook@chromium.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33706 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [v2 PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
` (4 preceding siblings ...)
2020-06-11 10:53 ` kernel test robot
@ 2020-06-11 11:49 ` Herbert Xu
2020-06-12 6:57 ` [v3 " Herbert Xu
5 siblings, 1 reply; 10+ messages in thread
From: Herbert Xu @ 2020-06-11 11:49 UTC (permalink / raw)
To: Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
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.
Unfortunately a number of drivers were relying on linux/uio.h to
provide access to linux/slab.h. This patch adds inclusions of
linux/slab.h as detected by build failures.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c
index 6d0bec947636..e237d6038407 100644
--- a/drivers/dma/sf-pdma/sf-pdma.c
+++ b/drivers/dma/sf-pdma/sf-pdma.c
@@ -20,6 +20,7 @@
#include <linux/mod_devicetable.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
+#include <linux/slab.h>
#include "sf-pdma.h"
diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index d39307f060bd..5a984df0e95e 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -4,6 +4,7 @@
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/poll.h>
+#include <linux/slab.h>
#include <linux/uacce.h>
static struct class *uacce_class;
diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c
index 17ad3b8698e1..aa2e3fe19c0f 100644
--- a/drivers/soc/qcom/pdr_interface.c
+++ b/drivers/soc/qcom/pdr_interface.c
@@ -5,6 +5,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 320d1062068d..d1e03b8cb6bb 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3,6 +3,7 @@
* Copyright (C) 2007 Oracle. All rights reserved.
*/
+#include <crypto/hash.h>
#include <linux/kernel.h>
#include <linux/bio.h>
#include <linux/buffer_head.h>
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 9576fd8158d7..3835a8a8e9ea 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -7,7 +7,6 @@
#include <linux/kernel.h>
#include <linux/thread_info.h>
-#include <crypto/hash.h>
#include <uapi/linux/uio.h>
struct page;
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 51595bf3af85..2830daf46c73 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>
@@ -1566,7 +1567,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
+#ifdef CONFIG_CRYPTO_HASH
struct ahash_request *hash = hashp;
struct scatterlist sg;
size_t copied;
diff --git a/drivers/mtd/mtdpstore.c b/drivers/mtd/mtdpstore.c
index a4fe6060b960..a3ae8778f6a9 100644
--- a/drivers/mtd/mtdpstore.c
+++ b/drivers/mtd/mtdpstore.c
@@ -7,6 +7,7 @@
#include <linux/pstore_blk.h>
#include <linux/mtd/mtd.h>
#include <linux/bitops.h>
+#include <linux/slab.h>
static struct mtdpstore_context {
int index;
--
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [v3 PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-11 11:49 ` [v2 PATCH] " Herbert Xu
@ 2020-06-12 6:57 ` Herbert Xu
2020-06-15 7:09 ` Christoph Hellwig
2020-06-15 14:16 ` Al Viro
0 siblings, 2 replies; 10+ messages in thread
From: Herbert Xu @ 2020-06-12 6:57 UTC (permalink / raw)
To: Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List
Cc: netdev
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.
Unfortunately a number of drivers were relying on linux/uio.h to
provide access to linux/slab.h. This patch adds inclusions of
linux/slab.h as detected by build failures.
Also skbuff.h was relying on this to provide a declaration for
ahash_request. This patch adds a forward declaration instead.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c
index 6d0bec947636..e237d6038407 100644
--- a/drivers/dma/sf-pdma/sf-pdma.c
+++ b/drivers/dma/sf-pdma/sf-pdma.c
@@ -20,6 +20,7 @@
#include <linux/mod_devicetable.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
+#include <linux/slab.h>
#include "sf-pdma.h"
diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index d39307f060bd..5a984df0e95e 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -4,6 +4,7 @@
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/poll.h>
+#include <linux/slab.h>
#include <linux/uacce.h>
static struct class *uacce_class;
diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c
index 17ad3b8698e1..aa2e3fe19c0f 100644
--- a/drivers/soc/qcom/pdr_interface.c
+++ b/drivers/soc/qcom/pdr_interface.c
@@ -5,6 +5,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 320d1062068d..d1e03b8cb6bb 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3,6 +3,7 @@
* Copyright (C) 2007 Oracle. All rights reserved.
*/
+#include <crypto/hash.h>
#include <linux/kernel.h>
#include <linux/bio.h>
#include <linux/buffer_head.h>
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 9576fd8158d7..3835a8a8e9ea 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -7,7 +7,6 @@
#include <linux/kernel.h>
#include <linux/thread_info.h>
-#include <crypto/hash.h>
#include <uapi/linux/uio.h>
struct page;
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 51595bf3af85..2830daf46c73 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>
@@ -1566,7 +1567,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
+#ifdef CONFIG_CRYPTO_HASH
struct ahash_request *hash = hashp;
struct scatterlist sg;
size_t copied;
diff --git a/drivers/mtd/mtdpstore.c b/drivers/mtd/mtdpstore.c
index a4fe6060b960..a3ae8778f6a9 100644
--- a/drivers/mtd/mtdpstore.c
+++ b/drivers/mtd/mtdpstore.c
@@ -7,6 +7,7 @@
#include <linux/pstore_blk.h>
#include <linux/mtd/mtd.h>
#include <linux/bitops.h>
+#include <linux/slab.h>
static struct mtdpstore_context {
int index;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 3a2ac7072dbb..36df5998d23c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -238,6 +238,7 @@
SKB_DATA_ALIGN(sizeof(struct sk_buff)) + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
+struct ahash_request;
struct net_device;
struct scatterlist;
struct pipe_inode_info;
--
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [v3 PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-12 6:57 ` [v3 " Herbert Xu
@ 2020-06-15 7:09 ` Christoph Hellwig
2020-06-15 14:16 ` Al Viro
1 sibling, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-06-15 7:09 UTC (permalink / raw)
To: Herbert Xu
Cc: Alexander Viro, Sagi Grimberg, Christoph Hellwig,
David S. Miller, Linux Kernel Mailing List, netdev
On Fri, Jun 12, 2020 at 04:57:37PM +1000, Herbert Xu wrote:
> 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.
>
> Unfortunately a number of drivers were relying on linux/uio.h to
> provide access to linux/slab.h. This patch adds inclusions of
> linux/slab.h as detected by build failures.
>
> Also skbuff.h was relying on this to provide a declaration for
> ahash_request. This patch adds a forward declaration instead.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [v3 PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h
2020-06-12 6:57 ` [v3 " Herbert Xu
2020-06-15 7:09 ` Christoph Hellwig
@ 2020-06-15 14:16 ` Al Viro
1 sibling, 0 replies; 10+ messages in thread
From: Al Viro @ 2020-06-15 14:16 UTC (permalink / raw)
To: Herbert Xu
Cc: Sagi Grimberg, Christoph Hellwig, David S. Miller,
Linux Kernel Mailing List, netdev
On Fri, Jun 12, 2020 at 04:57:37PM +1000, Herbert Xu wrote:
> 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.
>
> Unfortunately a number of drivers were relying on linux/uio.h to
> provide access to linux/slab.h. This patch adds inclusions of
> linux/slab.h as detected by build failures.
>
> Also skbuff.h was relying on this to provide a declaration for
> ahash_request. This patch adds a forward declaration instead.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Applied; let it sit in -next for a while to get better build coverage...
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-06-15 14:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 7:43 [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h Herbert Xu
2020-06-11 7:56 ` 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
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).