CC: [email protected] CC: [email protected] CC: [email protected] CC: Mark Brown <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3ca706c189db861b2ca2019a0901b94050ca49d8 commit: 8db90aa36063f471bea1e65e23185913043852dc Merge tag 'v5.11-rc1' into spi-5.11 date: 9 months ago :::::: branch date: 10 hours ago :::::: commit date: 9 months ago config: riscv-randconfig-c006-20210913 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a) 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 # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8db90aa36063f471bea1e65e23185913043852dc git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 8db90aa36063f471bea1e65e23185913043852dc # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 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 >>) ^ drivers/mtd/nand/raw/diskonchip.c:1389:9: note: Loop condition is false. Exiting loop tmpb = ReadDOC_(virtadr, reg) & DOC_TOGGLE_BIT; ^ include/linux/mtd/doc2000.h:103:33: note: expanded from macro 'ReadDOC_' #define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) ^ arch/riscv/include/asm/mmio.h:138:30: note: expanded from macro 'readb' #define readb(c) ({ u8 __v; __io_br(); __v = readb_cpu(c); __io_ar(__v); __v; }) ^ arch/riscv/include/asm/mmio.h:133:19: note: expanded from macro '__io_br' #define __io_br() do {} while (0) ^ drivers/mtd/nand/raw/diskonchip.c:1390:9: note: Loop condition is false. Exiting loop tmpc = ReadDOC_(virtadr, reg) & DOC_TOGGLE_BIT; ^ include/linux/mtd/doc2000.h:103:33: note: expanded from macro 'ReadDOC_' #define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) ^ arch/riscv/include/asm/mmio.h:138:30: note: expanded from macro 'readb' #define readb(c) ({ u8 __v; __io_br(); __v = readb_cpu(c); __io_ar(__v); __v; }) ^ arch/riscv/include/asm/mmio.h:133:19: note: expanded from macro '__io_br' #define __io_br() do {} while (0) ^ drivers/mtd/nand/raw/diskonchip.c:1391:7: note: Assuming 'tmp' is not equal to 'tmpb' if ((tmp == tmpb) || (tmp != tmpc)) { ^~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:1391:6: note: Left side of '||' is false if ((tmp == tmpb) || (tmp != tmpc)) { ^ drivers/mtd/nand/raw/diskonchip.c:1391:24: note: Assuming 'tmp' is equal to 'tmpc' if ((tmp == tmpb) || (tmp != tmpc)) { ^~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:1391:2: note: Taking false branch if ((tmp == tmpb) || (tmp != tmpc)) { ^ drivers/mtd/nand/raw/diskonchip.c:1397:2: note: Loop condition is false. Execution continues on line 1432 for (mtd = doclist; mtd; mtd = doc->nextdoc) { ^ drivers/mtd/nand/raw/diskonchip.c:1437:6: note: Assuming 'nand' is non-null if (!nand) { ^~~~~ drivers/mtd/nand/raw/diskonchip.c:1437:2: note: Taking false branch if (!nand) { ^ drivers/mtd/nand/raw/diskonchip.c:1453:6: note: Assuming field 'rs_decoder' is non-null if (!doc->rs_decoder) { ^~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:1453:2: note: Taking false branch if (!doc->rs_decoder) { ^ drivers/mtd/nand/raw/diskonchip.c:1460:6: note: 'ChipID' is not equal to DOC_ChipID_DocMilPlus16 if (ChipID == DOC_ChipID_DocMilPlus16) ^~~~~~ drivers/mtd/nand/raw/diskonchip.c:1460:2: note: Taking false branch if (ChipID == DOC_ChipID_DocMilPlus16) ^ drivers/mtd/nand/raw/diskonchip.c:1487:6: note: 'ChipID' is equal to DOC_ChipID_Doc2k if (ChipID == DOC_ChipID_Doc2k) ^~~~~~ drivers/mtd/nand/raw/diskonchip.c:1487:2: note: Taking true branch if (ChipID == DOC_ChipID_Doc2k) ^ drivers/mtd/nand/raw/diskonchip.c:1488:14: note: Calling 'doc2000_init' numchips = doc2000_init(mtd); ^~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:1227:2: note: Calling 'doc2000_count_chips' doc2000_count_chips(mtd); ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:404:10: note: Calling 'doc200x_ident_chip' mfrid = doc200x_ident_chip(mtd, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:369:2: note: Calling 'doc200x_readid' doc200x_readid(this, nr, id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:356:7: note: 'id' is non-null if (!id) ^~ drivers/mtd/nand/raw/diskonchip.c:356:2: note: Taking false branch if (!id) ^ drivers/mtd/nand/raw/diskonchip.c:360:1: note: Returning without writing to '*id' } ^ drivers/mtd/nand/raw/diskonchip.c:369:2: note: Returning from 'doc200x_readid' doc200x_readid(this, nr, id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:371:20: note: The left operand of '<<' is a garbage value ret = ((u16)id[0] << 8) | id[1]; ~~~~~ ^ drivers/mtd/nand/raw/diskonchip.c:896:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores] ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/nand/raw/diskonchip.c:896:2: note: Value stored to 'ret' is never read ret = mtd_read(mtd, offs, mtd->writesize, &retlen, buf); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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/spi/spi-geni-qcom.c:467:19: warning: Division by zero >> [clang-analyzer-core.DivideZero] for (i = 0; i < DIV_ROUND_UP(rx_bytes, bytes_per_fifo_word); i++) ^ include/linux/math.h:36:22: note: expanded from macro 'DIV_ROUND_UP' #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP ^ include/uapi/linux/const.h:34:54: note: expanded from macro '__KERNEL_DIV_ROUND_UP' #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) ^ drivers/spi/spi-geni-qcom.c:589:10: note: Loop condition is false. Exiting loop m_irq = readl(se->base + SE_GENI_M_IRQ_STATUS); ^ arch/riscv/include/asm/mmio.h:140:30: note: expanded from macro 'readl' #define readl(c) ({ u32 __v; __io_br(); __v = readl_cpu(c); __io_ar(__v); __v; }) ^ arch/riscv/include/asm/mmio.h:133:19: note: expanded from macro '__io_br' #define __io_br() do {} while (0) ^ drivers/spi/spi-geni-qcom.c:590:6: note: Assuming 'm_irq' is not equal to 0 if (!m_irq) ^~~~~~ drivers/spi/spi-geni-qcom.c:590:2: note: Taking false branch if (!m_irq) ^ drivers/spi/spi-geni-qcom.c:593:6: note: Assuming the condition is false if (m_irq & (M_CMD_OVERRUN_EN | M_ILLEGAL_CMD_EN | M_CMD_FAILURE_EN | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:593:2: note: Taking false branch if (m_irq & (M_CMD_OVERRUN_EN | M_ILLEGAL_CMD_EN | M_CMD_FAILURE_EN | ^ drivers/spi/spi-geni-qcom.c:600:7: note: Assuming the condition is false if ((m_irq & M_RX_FIFO_WATERMARK_EN) || (m_irq & M_RX_FIFO_LAST_EN)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:600:6: note: Left side of '||' is false if ((m_irq & M_RX_FIFO_WATERMARK_EN) || (m_irq & M_RX_FIFO_LAST_EN)) ^ drivers/spi/spi-geni-qcom.c:600:43: note: Assuming the condition is true if ((m_irq & M_RX_FIFO_WATERMARK_EN) || (m_irq & M_RX_FIFO_LAST_EN)) ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:600:2: note: Taking true branch if ((m_irq & M_RX_FIFO_WATERMARK_EN) || (m_irq & M_RX_FIFO_LAST_EN)) ^ drivers/spi/spi-geni-qcom.c:601:3: note: Calling 'geni_spi_handle_rx' geni_spi_handle_rx(mas); ^~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:453:37: note: Calling 'geni_byte_per_fifo_word' unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:401:6: note: Assuming the condition is true if (mas->fifo_width_bits % mas->cur_bits_per_word) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:401:2: note: Taking true branch if (mas->fifo_width_bits % mas->cur_bits_per_word) ^ drivers/spi/spi-geni-qcom.c:402:10: note: '?' condition is false return roundup_pow_of_two(DIV_ROUND_UP(mas->cur_bits_per_word, ^ include/linux/log2.h:176:2: note: expanded from macro 'roundup_pow_of_two' __builtin_constant_p(n) ? ( \ ^ drivers/spi/spi-geni-qcom.c:402:10: note: Calling '__roundup_pow_of_two' return roundup_pow_of_two(DIV_ROUND_UP(mas->cur_bits_per_word, ^ include/linux/log2.h:180:2: note: expanded from macro 'roundup_pow_of_two' __roundup_pow_of_two(n) \ ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:2: note: Returning the value 9223372036854775808 return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:402:10: note: Returning from '__roundup_pow_of_two' return roundup_pow_of_two(DIV_ROUND_UP(mas->cur_bits_per_word, ^ include/linux/log2.h:180:2: note: expanded from macro 'roundup_pow_of_two' __roundup_pow_of_two(n) \ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:402:3: note: Returning without writing to 'mas->cur_xfer', which participates in a condition later return roundup_pow_of_two(DIV_ROUND_UP(mas->cur_bits_per_word, ^ drivers/spi/spi-geni-qcom.c:402:3: note: Returning zero return roundup_pow_of_two(DIV_ROUND_UP(mas->cur_bits_per_word, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:453:37: note: Returning from 'geni_byte_per_fifo_word' unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:453:2: note: 'bytes_per_fifo_word' initialized to 0 unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:456:19: note: Loop condition is false. Exiting loop rx_fifo_status = readl(se->base + SE_GENI_RX_FIFO_STATUS); ^ arch/riscv/include/asm/mmio.h:140:30: note: expanded from macro 'readl' #define readl(c) ({ u32 __v; __io_br(); __v = readl_cpu(c); __io_ar(__v); __v; }) ^ arch/riscv/include/asm/mmio.h:133:19: note: expanded from macro '__io_br' #define __io_br() do {} while (0) ^ drivers/spi/spi-geni-qcom.c:458:6: note: Assuming the condition is false if (rx_fifo_status & RX_LAST) { ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-geni-qcom.c:458:2: note: Taking false branch if (rx_fifo_status & RX_LAST) { vim +467 drivers/spi/spi-geni-qcom.c 6d66507d9b5507 Douglas Anderson 2020-09-12 445 6d66507d9b5507 Douglas Anderson 2020-09-12 446 static void geni_spi_handle_rx(struct spi_geni_master *mas) 6d66507d9b5507 Douglas Anderson 2020-09-12 447 { 6d66507d9b5507 Douglas Anderson 2020-09-12 448 struct geni_se *se = &mas->se; 6d66507d9b5507 Douglas Anderson 2020-09-12 449 u32 rx_fifo_status; 6d66507d9b5507 Douglas Anderson 2020-09-12 450 unsigned int rx_bytes; 6d66507d9b5507 Douglas Anderson 2020-09-12 451 unsigned int rx_last_byte_valid; 6d66507d9b5507 Douglas Anderson 2020-09-12 452 u8 *rx_buf; 6d66507d9b5507 Douglas Anderson 2020-09-12 453 unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); 6d66507d9b5507 Douglas Anderson 2020-09-12 454 unsigned int i = 0; 6d66507d9b5507 Douglas Anderson 2020-09-12 455 6d66507d9b5507 Douglas Anderson 2020-09-12 456 rx_fifo_status = readl(se->base + SE_GENI_RX_FIFO_STATUS); 6d66507d9b5507 Douglas Anderson 2020-09-12 457 rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word; 6d66507d9b5507 Douglas Anderson 2020-09-12 458 if (rx_fifo_status & RX_LAST) { 6d66507d9b5507 Douglas Anderson 2020-09-12 459 rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK; 6d66507d9b5507 Douglas Anderson 2020-09-12 460 rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT; 6d66507d9b5507 Douglas Anderson 2020-09-12 461 if (rx_last_byte_valid && rx_last_byte_valid < 4) 6d66507d9b5507 Douglas Anderson 2020-09-12 462 rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid; 6d66507d9b5507 Douglas Anderson 2020-09-12 463 } 4aa1464acbe369 Douglas Anderson 2020-12-17 464 4aa1464acbe369 Douglas Anderson 2020-12-17 465 /* Clear out the FIFO and bail if nowhere to put it */ 4aa1464acbe369 Douglas Anderson 2020-12-17 466 if (!mas->cur_xfer) { 4aa1464acbe369 Douglas Anderson 2020-12-17 @467 for (i = 0; i < DIV_ROUND_UP(rx_bytes, bytes_per_fifo_word); i++) 4aa1464acbe369 Douglas Anderson 2020-12-17 468 readl(se->base + SE_GENI_RX_FIFOn); 4aa1464acbe369 Douglas Anderson 2020-12-17 469 return; 4aa1464acbe369 Douglas Anderson 2020-12-17 470 } 4aa1464acbe369 Douglas Anderson 2020-12-17 471 6d66507d9b5507 Douglas Anderson 2020-09-12 472 if (mas->rx_rem_bytes < rx_bytes) 6d66507d9b5507 Douglas Anderson 2020-09-12 473 rx_bytes = mas->rx_rem_bytes; 6d66507d9b5507 Douglas Anderson 2020-09-12 474 6d66507d9b5507 Douglas Anderson 2020-09-12 475 rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes; 6d66507d9b5507 Douglas Anderson 2020-09-12 476 while (i < rx_bytes) { 6d66507d9b5507 Douglas Anderson 2020-09-12 477 u32 fifo_word = 0; 6d66507d9b5507 Douglas Anderson 2020-09-12 478 u8 *fifo_byte = (u8 *)&fifo_word; 6d66507d9b5507 Douglas Anderson 2020-09-12 479 unsigned int bytes_to_read; 6d66507d9b5507 Douglas Anderson 2020-09-12 480 unsigned int j; 6d66507d9b5507 Douglas Anderson 2020-09-12 481 6d66507d9b5507 Douglas Anderson 2020-09-12 482 bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i); 6d66507d9b5507 Douglas Anderson 2020-09-12 483 ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1); 6d66507d9b5507 Douglas Anderson 2020-09-12 484 for (j = 0; j < bytes_to_read; j++) 6d66507d9b5507 Douglas Anderson 2020-09-12 485 rx_buf[i++] = fifo_byte[j]; 6d66507d9b5507 Douglas Anderson 2020-09-12 486 } 6d66507d9b5507 Douglas Anderson 2020-09-12 487 mas->rx_rem_bytes -= rx_bytes; 6d66507d9b5507 Douglas Anderson 2020-09-12 488 } 6d66507d9b5507 Douglas Anderson 2020-09-12 489 :::::: The code at line 467 was first introduced by commit :::::: 4aa1464acbe3697710279a4bd65cb4801ed30425 spi: spi-geni-qcom: Fix geni_spi_isr() NULL dereference in timeout case :::::: TO: Douglas Anderson <[email protected]> :::::: CC: Mark Brown <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
