tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 196d330d7fb1e7cc0d85641c89ce4602cb36f12e commit: 28e77cc1c0686621a4d416f599cee5ab369daa0a [4917/7526] fortify: Detect struct member overflows in memset() at compile-time config: s390-randconfig-s031-20220223 (https://download.01.org/0day-ci/archive/20220224/202202240813.KmAiCopu-lkp@xxxxxxxxx/config) compiler: s390-linux-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=28e77cc1c0686621a4d416f599cee5ab369daa0a git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 28e77cc1c0686621a4d416f599cee5ab369daa0a # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash drivers/mtd/nand/raw/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) drivers/mtd/nand/raw/hisi504_nand.c:362:26: sparse: sparse: cast removes address space '__iomem' of expression drivers/mtd/nand/raw/hisi504_nand.c:367:26: sparse: sparse: cast removes address space '__iomem' of expression >> drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio >> drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: expected void * drivers/mtd/nand/raw/hisi504_nand.c:465:17: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: expected void * drivers/mtd/nand/raw/hisi504_nand.c:477:17: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void const * drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *mmio @@ drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: expected void * drivers/mtd/nand/raw/hisi504_nand.c:603:9: sparse: got void [noderef] __iomem *mmio vim +465 drivers/mtd/nand/raw/hisi504_nand.c 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 422 5295cf2e047cf6 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 423 static void hisi_nfc_cmdfunc(struct nand_chip *chip, unsigned command, 5295cf2e047cf6 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 424 int column, int page_addr) 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 425 { 5295cf2e047cf6 drivers/mtd/nand/raw/hisi504_nand.c Boris Brezillon 2018-09-06 426 struct mtd_info *mtd = nand_to_mtd(chip); d699ed250c0738 drivers/mtd/nand/hisi504_nand.c Boris Brezillon 2015-12-10 427 struct hinfc_host *host = nand_get_controller_data(chip); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 428 int is_cache_invalid = 1; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 429 unsigned int flag = 0; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 430 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 431 host->command = command; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 432 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 433 switch (command) { 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 434 case NAND_CMD_READ0: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 435 case NAND_CMD_READOOB: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 436 if (command == NAND_CMD_READ0) 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 437 host->offset = column; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 438 else 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 439 host->offset = column + mtd->writesize; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 440 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 441 is_cache_invalid = 0; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 442 set_addr(mtd, column, page_addr); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 443 hisi_nfc_send_cmd_readstart(host); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 444 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 445 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 446 case NAND_CMD_SEQIN: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 447 host->offset = column; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 448 set_addr(mtd, column, page_addr); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 449 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 450 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 451 case NAND_CMD_ERASE1: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 452 set_addr(mtd, column, page_addr); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 453 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 454 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 455 case NAND_CMD_PAGEPROG: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 456 hisi_nfc_send_cmd_pageprog(host); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 457 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 458 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 459 case NAND_CMD_ERASE2: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 460 hisi_nfc_send_cmd_erase(host); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 461 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 462 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 463 case NAND_CMD_READID: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 464 host->offset = column; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 @465 memset(host->mmio, 0, 0x10); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 466 hisi_nfc_send_cmd_readid(host); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 467 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 468 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 469 case NAND_CMD_STATUS: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 470 flag = hinfc_read(host, HINFC504_CON); bace41f80f65dc drivers/mtd/nand/raw/hisi504_nand.c Miquel Raynal 2020-08-27 471 if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 472 hinfc_write(host, dd58d38fb30aa9 drivers/mtd/nand/hisi504_nand.c Dan Carpenter 2015-02-11 473 flag & ~(HINFC504_CON_ECCTYPE_MASK << 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 474 HINFC504_CON_ECCTYPE_SHIFT), HINFC504_CON); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 475 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 476 host->offset = 0; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 477 memset(host->mmio, 0, 0x10); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 478 hisi_nfc_send_cmd_status(host); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 479 hinfc_write(host, flag, HINFC504_CON); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 480 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 481 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 482 case NAND_CMD_RESET: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 483 hisi_nfc_send_cmd_reset(host, host->chipselect); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 484 break; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 485 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 486 default: 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 487 dev_err(host->dev, "Error: unsupported cmd(cmd=%x, col=%x, page=%x)\n", 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 488 command, column, page_addr); 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 489 } 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 490 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 491 if (is_cache_invalid) { 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 492 host->cache_addr_value[0] = ~0; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 493 host->cache_addr_value[1] = ~0; 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 494 } 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 495 } 54f531f6e33287 drivers/mtd/nand/hisi504_nand.c Zhou Wang 2015-01-25 496 :::::: The code at line 465 was first introduced by commit :::::: 54f531f6e332875bd8a604871532f7f1174adc0e mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc :::::: TO: Zhou Wang <wangzhou1@xxxxxxxxxxxxx> :::::: CC: Brian Norris <computersforpeace@xxxxxxxxx> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx