Re: [PATCH] iov_iter: Move unnecessary inclusion of crypto/hash.h

From: kernel test robot
Date: Thu Jun 11 2020 - 06:54:18 EST


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@xxxxxxxxx>

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@xxxxxxxxxxxxxxxxx>
:::::: CC: Kees Cook <keescook@xxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip