CC: [email protected] CC: [email protected] CC: [email protected] TO: Miquel Raynal <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3498e7f2bb415e447354a3debef6738d9655768c commit: 3d1f08b032dc4e168f3aefed1e07a63c3c080325 mtd: spinand: Use the external ECC engine logic date: 12 months ago :::::: branch date: 14 hours ago :::::: commit date: 12 months ago config: x86_64-randconfig-c007-20211118 (https://download.01.org/0day-ci/archive/20211128/[email protected]/config) 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 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d1f08b032dc4e168f3aefed1e07a63c3c080325 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 3d1f08b032dc4e168f3aefed1e07a63c3c080325 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) ^~~~~ ~~~~~~~~~~~~~~~~ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 15 warnings generated. drivers/usb/serial/iuu_phoenix.c:243:6: warning: Value stored to 'status' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int status = urb->status; ^~~~~~ ~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:243:6: note: Value stored to 'status' during its initialization is never read int status = urb->status; ^~~~~~ ~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:532:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct device *dev = &port->dev; ^~~ ~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:532:17: note: Value stored to 'dev' during its initialization is never read struct device *dev = &port->dev; ^~~ ~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:655:3: warning: Value stored to 'error' is never read [clang-analyzer-deadcode.DeadStores] error = 1; ^ ~ drivers/usb/serial/iuu_phoenix.c:655:3: note: Value stored to 'error' is never read error = 1; ^ ~ drivers/usb/serial/iuu_phoenix.c:663:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores] status = iuu_read_buf(port, len); ^ ~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:663:3: note: Value stored to 'status' is never read status = iuu_read_buf(port, len); ^ ~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:668:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores] status = iuu_status(port); ^ ~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:668:3: note: Value stored to 'status' is never read status = iuu_status(port); ^ ~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:676:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores] status = iuu_reset(port, 0xC); ^ ~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:676:3: note: Value stored to 'status' is never read status = iuu_reset(port, 0xC); ^ ~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:683:3: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores] status = iuu_bulk_write(port); ^ ~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:683:3: note: Value stored to 'status' is never read status = iuu_bulk_write(port); ^ ~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:729:2: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores] result = usb_submit_urb(port->read_urb, GFP_ATOMIC); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:729:2: note: Value stored to 'result' is never read result = usb_submit_urb(port->read_urb, GFP_ATOMIC); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/serial/iuu_phoenix.c:992:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores] result = ^ drivers/usb/serial/iuu_phoenix.c:992:3: note: Value stored to 'result' is never read result = ^ drivers/usb/serial/iuu_phoenix.c:1000:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores] result = ^ drivers/usb/serial/iuu_phoenix.c:1000:3: note: Value stored to 'result' is never read result = ^ drivers/usb/serial/iuu_phoenix.c:1007:3: warning: Value stored to 'result' is never read [clang-analyzer-deadcode.DeadStores] result = ^ drivers/usb/serial/iuu_phoenix.c:1007:3: note: Value stored to 'result' is never read result = ^ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 4 warnings generated. drivers/mtd/nand/raw/r852.c:593:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy] strcpy(buf, data); ^~~~~~ drivers/mtd/nand/raw/r852.c:593:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 strcpy(buf, data); ^~~~~~ Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 3 warnings generated. Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. >> drivers/mtd/nand/spi/core.c:382:3: warning: Null pointer passed as 2nd >> argument to memory copy function [clang-analyzer-unix.cstring.NullArg] memcpy(req->databuf.in, spinand->databuf + req->dataoffs, ^ drivers/mtd/nand/spi/core.c:680:2: note: Calling 'spinand_read_page' spinand_read_page(spinand, &req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:528:29: note: Calling 'spinand_to_nand' struct nand_device *nand = spinand_to_nand(spinand); ^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/mtd/spinand.h:469:2: note: Returning without writing to 'spinand->base.memorg.oobsize', which participates in a condition later return &spinand->base; ^ include/linux/mtd/spinand.h:469:2: note: Returning without writing to 'spinand->databuf' drivers/mtd/nand/spi/core.c:528:29: note: Returning from 'spinand_to_nand' struct nand_device *nand = spinand_to_nand(spinand); ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:532:8: note: Value assigned to field 'databuf' ret = nand_ecc_prepare_io_req(nand, (struct nand_page_io_req *)req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:533:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/mtd/nand/spi/core.c:533:2: note: Taking false branch if (ret) ^ drivers/mtd/nand/spi/core.c:536:8: note: Calling 'spinand_load_page_op' ret = spinand_load_page_op(spinand, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:335:29: note: Calling 'spinand_to_nand' struct nand_device *nand = spinand_to_nand(spinand); ^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/mtd/spinand.h:469:2: note: Returning without writing to 'spinand->base.memorg.oobsize', which participates in a condition later return &spinand->base; ^ include/linux/mtd/spinand.h:469:2: note: Returning without writing to 'spinand->databuf' drivers/mtd/nand/spi/core.c:335:29: note: Returning from 'spinand_to_nand' struct nand_device *nand = spinand_to_nand(spinand); ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:336:21: note: Calling 'nanddev_pos_to_row' unsigned int row = nanddev_pos_to_row(nand, &req->pos); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/mtd/nand.h:763:2: note: Returning without writing to 'nand->memorg.oobsize', which participates in a condition later return (pos->lun << nand->rowconv.lun_addr_shift) | ^ drivers/mtd/nand/spi/core.c:336:21: note: Returning from 'nanddev_pos_to_row' unsigned int row = nanddev_pos_to_row(nand, &req->pos); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:339:2: note: Returning without writing to 'spinand->base.memorg.oobsize', which participates in a condition later return spi_mem_exec_op(spinand->spimem, &op); ^ drivers/mtd/nand/spi/core.c:339:2: note: Returning without writing to 'spinand->databuf' drivers/mtd/nand/spi/core.c:536:8: note: Returning from 'spinand_load_page_op' ret = spinand_load_page_op(spinand, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:537:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/mtd/nand/spi/core.c:537:2: note: Taking false branch if (ret) ^ drivers/mtd/nand/spi/core.c:540:8: note: Calling 'spinand_wait' ret = spinand_wait(spinand, &status); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:471:9: note: Calling 'spinand_read_status' ret = spinand_read_status(spinand, &status); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:48:9: note: Calling 'spinand_read_reg_op' return spinand_read_reg_op(spinand, REG_STATUS, status); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:30:6: note: Assuming 'ret' is 0 if (ret) ^~~ drivers/mtd/nand/spi/core.c:30:2: note: Taking false branch if (ret) ^ drivers/mtd/nand/spi/core.c:34:2: note: Returning without writing to 'spinand->base.memorg.oobsize', which participates in a condition later return 0; ^ drivers/mtd/nand/spi/core.c:34:2: note: Returning without writing to 'spinand->databuf' drivers/mtd/nand/spi/core.c:48:9: note: Returning from 'spinand_read_reg_op' return spinand_read_reg_op(spinand, REG_STATUS, status); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:48:2: note: Returning without writing to 'spinand->base.memorg.oobsize', which participates in a condition later return spinand_read_reg_op(spinand, REG_STATUS, status); ^ drivers/mtd/nand/spi/core.c:48:2: note: Returning without writing to 'spinand->databuf' drivers/mtd/nand/spi/core.c:471:9: note: Returning from 'spinand_read_status' ret = spinand_read_status(spinand, &status); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:472:7: note: 'ret' is 0 if (ret) ^~~ drivers/mtd/nand/spi/core.c:472:3: note: Taking false branch if (ret) ^ drivers/mtd/nand/spi/core.c:475:7: note: Assuming the condition is true if (!(status & STATUS_BUSY)) ^~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/spi/core.c:475:3: note: Taking true branch if (!(status & STATUS_BUSY)) ^ vim +382 drivers/mtd/nand/spi/core.c 7529df4652482c Peter Pan 2018-06-22 341 7529df4652482c Peter Pan 2018-06-22 342 static int spinand_read_from_cache_op(struct spinand_device *spinand, 7529df4652482c Peter Pan 2018-06-22 343 const struct nand_page_io_req *req) 7529df4652482c Peter Pan 2018-06-22 344 { 7529df4652482c Peter Pan 2018-06-22 345 struct nand_device *nand = spinand_to_nand(spinand); 981d1aa0697ce1 Boris Brezillon 2019-01-24 346 struct spi_mem_dirmap_desc *rdesc; 7529df4652482c Peter Pan 2018-06-22 347 unsigned int nbytes = 0; 7529df4652482c Peter Pan 2018-06-22 348 void *buf = NULL; 7529df4652482c Peter Pan 2018-06-22 349 u16 column = 0; 981d1aa0697ce1 Boris Brezillon 2019-01-24 350 ssize_t ret; 7529df4652482c Peter Pan 2018-06-22 351 7529df4652482c Peter Pan 2018-06-22 352 if (req->datalen) { 7529df4652482c Peter Pan 2018-06-22 353 buf = spinand->databuf; 981d1aa0697ce1 Boris Brezillon 2019-01-24 354 nbytes = nanddev_page_size(nand); 981d1aa0697ce1 Boris Brezillon 2019-01-24 355 column = 0; 7529df4652482c Peter Pan 2018-06-22 356 } 7529df4652482c Peter Pan 2018-06-22 357 7529df4652482c Peter Pan 2018-06-22 358 if (req->ooblen) { 7529df4652482c Peter Pan 2018-06-22 359 nbytes += nanddev_per_page_oobsize(nand); 7529df4652482c Peter Pan 2018-06-22 360 if (!buf) { 7529df4652482c Peter Pan 2018-06-22 361 buf = spinand->oobbuf; 7529df4652482c Peter Pan 2018-06-22 362 column = nanddev_page_size(nand); 7529df4652482c Peter Pan 2018-06-22 363 } 7529df4652482c Peter Pan 2018-06-22 364 } 7529df4652482c Peter Pan 2018-06-22 365 981d1aa0697ce1 Boris Brezillon 2019-01-24 366 rdesc = spinand->dirmaps[req->pos.plane].rdesc; 7529df4652482c Peter Pan 2018-06-22 367 7529df4652482c Peter Pan 2018-06-22 368 while (nbytes) { 981d1aa0697ce1 Boris Brezillon 2019-01-24 369 ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf); 981d1aa0697ce1 Boris Brezillon 2019-01-24 370 if (ret < 0) 7529df4652482c Peter Pan 2018-06-22 371 return ret; 7529df4652482c Peter Pan 2018-06-22 372 981d1aa0697ce1 Boris Brezillon 2019-01-24 373 if (!ret || ret > nbytes) 981d1aa0697ce1 Boris Brezillon 2019-01-24 374 return -EIO; 7529df4652482c Peter Pan 2018-06-22 375 981d1aa0697ce1 Boris Brezillon 2019-01-24 376 nbytes -= ret; 981d1aa0697ce1 Boris Brezillon 2019-01-24 377 column += ret; 981d1aa0697ce1 Boris Brezillon 2019-01-24 378 buf += ret; 7529df4652482c Peter Pan 2018-06-22 379 } 7529df4652482c Peter Pan 2018-06-22 380 7529df4652482c Peter Pan 2018-06-22 381 if (req->datalen) 7529df4652482c Peter Pan 2018-06-22 @382 memcpy(req->databuf.in, spinand->databuf + req->dataoffs, 7529df4652482c Peter Pan 2018-06-22 383 req->datalen); 7529df4652482c Peter Pan 2018-06-22 384 7529df4652482c Peter Pan 2018-06-22 385 return 0; 7529df4652482c Peter Pan 2018-06-22 386 } 7529df4652482c Peter Pan 2018-06-22 387 :::::: The code at line 382 was first introduced by commit :::::: 7529df4652482c33ae1a99ee8189401146f13cb7 mtd: nand: Add core infrastructure to support SPI NANDs :::::: TO: Peter Pan <[email protected]> :::::: CC: Miquel Raynal <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
