All of lore.kernel.org
 help / color / mirror / Atom feed
* include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
@ 2021-08-17  6:25 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-17  6:25 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 28094 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alex Shi <alex.shi@linux.alibaba.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   794c7931a2428a656551f2179e6a093233a6e0aa
commit: 6168d0da2b479ce25a4647de194045de1bdd1f1d mm/lru: replace pgdat lru_lock with lruvec lock
date:   8 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6168d0da2b479ce25a4647de194045de1bdd1f1d
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6168d0da2b479ce25a4647de194045de1bdd1f1d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                  ^
   drivers/i2c/i2c-core-smbus.c:136:2: note: Undefined or garbage value returned to caller
           return (status < 0) ? status : data.byte;
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:176:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
           return (status < 0) ? status : data.word;
           ^
   drivers/i2c/i2c-core-smbus.c:643:6: note: Assuming 'length' is > I2C_SMBUS_BLOCK_MAX
           if (length > I2C_SMBUS_BLOCK_MAX)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:643:2: note: Taking true branch
           if (length > I2C_SMBUS_BLOCK_MAX)
           ^
   drivers/i2c/i2c-core-smbus.c:646:2: note: Taking false branch
           if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
           ^
   drivers/i2c/i2c-core-smbus.c:649:2: note: Taking false branch
           if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA))
           ^
   drivers/i2c/i2c-core-smbus.c:652:2: note: Taking true branch
           if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) {
           ^
   drivers/i2c/i2c-core-smbus.c:653:3: note: Loop condition is true.  Entering loop body
                   while ((i + 2) <= length) {
                   ^
   drivers/i2c/i2c-core-smbus.c:655:8: note: 'status' is >= 0
                           if (status < 0)
                               ^~~~~~
   drivers/i2c/i2c-core-smbus.c:655:4: note: Taking false branch
                           if (status < 0)
                           ^
   drivers/i2c/i2c-core-smbus.c:653:3: note: Loop condition is true.  Entering loop body
                   while ((i + 2) <= length) {
                   ^
   drivers/i2c/i2c-core-smbus.c:654:13: note: Calling 'i2c_smbus_read_word_data'
                           status = i2c_smbus_read_word_data(client, command + i);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:173:11: note: Calling 'i2c_smbus_xfer'
           status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:539:6: note: Assuming 'res' is not equal to 0
           if (res)
               ^~~
   drivers/i2c/i2c-core-smbus.c:539:2: note: Taking true branch
           if (res)
           ^
   drivers/i2c/i2c-core-smbus.c:540:3: note: Returning without writing to 'data->word'
                   return res;
                   ^
   drivers/i2c/i2c-core-smbus.c:173:11: note: Returning from 'i2c_smbus_xfer'
           status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:176:10: note: Assuming 'status' is >= 0
           return (status < 0) ? status : data.word;
                   ^~~~~~~~~~
   drivers/i2c/i2c-core-smbus.c:176:9: note: '?' condition is false
           return (status < 0) ? status : data.word;
                  ^
   drivers/i2c/i2c-core-smbus.c:176:2: note: Undefined or garbage value returned to caller
           return (status < 0) ? status : data.word;
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   fs/autofs/root.c:560: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(cp, symname);
           ^~~~~~
   fs/autofs/root.c:560: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(cp, symname);
           ^~~~~~
   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.
   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.
   5 warnings generated.
   fs/autofs/dev-ioctl.c:518:34: warning: Although the value stored to 'devid' is used in the enclosing expression, the value is never actually read from 'devid' [clang-analyzer-deadcode.DeadStores]
           param->ismountpoint.out.devid = devid = 0;
                                           ^       ~
   fs/autofs/dev-ioctl.c:518:34: note: Although the value stored to 'devid' is used in the enclosing expression, the value is never actually read from 'devid'
           param->ismountpoint.out.devid = devid = 0;
                                           ^       ~
   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.
   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.
   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.
   7 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/vmscan.c:4268:2: note: 'lruvec' initialized to a null pointer value
           struct lruvec *lruvec = NULL;
           ^~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4273:14: note: Assuming 'i' is < field 'nr'
           for (i = 0; i < pvec->nr; i++) {
                       ^~~~~~~~~~~~
   mm/vmscan.c:4273:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < pvec->nr; i++) {
           ^
   mm/vmscan.c:4278:7: note: Calling 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:698:1: note: Returning zero, which participates in a condition later
   TESTPAGEFLAG_FALSE(TransTail)
   ^
   include/linux/page-flags.h:305:58: note: expanded from macro 'TESTPAGEFLAG_FALSE'
   static inline int Page##uname(const struct page *page) { return 0; }
                                                            ^~~~~~~~
   mm/vmscan.c:4278:7: note: Returning from 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4278:3: note: Taking false branch
                   if (PageTransTail(page))
                   ^
   mm/vmscan.c:4285:8: note: Calling 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: '?' condition is true
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^
   arch/arm/include/asm/bitops.h:181:3: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
            ^
   include/linux/page-flags.h:337:2: note: Calling '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   arch/arm/include/asm/bitops.h:98:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_save(flags);
           ^
   include/linux/irqflags.h:158:2: note: expanded from macro 'raw_local_irq_save'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:101:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_restore(flags);
           ^
   include/linux/irqflags.h:163:2: note: expanded from macro 'raw_local_irq_restore'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:103:9: note: Assuming the condition is true
           return (res & mask) != 0;
                  ^~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:103:2: note: Returning the value 1, which participates in a condition later
           return (res & mask) != 0;
           ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: Returning from '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/page-flags.h:337:2: note: Returning the value 1, which participates in a condition later
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:4: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:8: note: Returning from 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:3: note: Taking false branch
                   if (!TestClearPageLRU(page))
                   ^
   mm/vmscan.c:4289:7: note: Assuming 'lruvec' is equal to 'new_lruvec'
                   if (lruvec != new_lruvec) {
                       ^~~~~~~~~~~~~~~~~~~~
--
   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.
   4 warnings generated.
   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.
   4 warnings generated.
   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.
   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.
   7 warnings generated.
   drivers/misc/eeprom/idt_89hpesx.c:977:3: warning: Value stored to 'csraddr_len' is never read [clang-analyzer-deadcode.DeadStores]
                   csraddr_len = strnlen(csraddr_str, count);
                   ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/misc/eeprom/idt_89hpesx.c:977:3: note: Value stored to 'csraddr_len' is never read
                   csraddr_len = strnlen(csraddr_str, count);
                   ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (3 in non-user code, 3 with check filters).
   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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   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.
   5 warnings generated.
   mm/oom_kill.c:257:17: warning: Value stored to 'highest_zoneidx' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   mm/oom_kill.c:257:17: note: Value stored to 'highest_zoneidx' during its initialization is never read
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
   mm/page-writeback.c:1408:14: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/page-writeback.c:1407:6: note: Assuming 'thresh' is > 'dirty'
           if (thresh > dirty)
               ^~~~~~~~~~~~~~
   mm/page-writeback.c:1407:2: note: Taking true branch
           if (thresh > dirty)
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is false
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is true
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:160:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   mm/page-writeback.c:1408:14: note: The result of the left shift is undefined because the right operand is negative
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/swap.c:851:2: note: Calling 'lru_add_drain'
           lru_add_drain();
           ^~~~~~~~~~~~~~~
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:58:3: note: expanded from macro '__local_lock'
                   preempt_disable();                              \
                   ^
   include/linux/preempt.h:169:27: note: expanded from macro 'preempt_disable'
   #define preempt_disable() \
                             ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:59:22: note: expanded from macro '__local_lock'
                   local_lock_acquire(this_cpu_ptr(lock));         \
                                      ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)
                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:57:2: note: expanded from macro '__local_lock'
           do {                                                    \
           ^
   mm/swap.c:727:2: note: Calling 'lru_add_drain_cpu'
           lru_add_drain_cpu(smp_processor_id());
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/swap.c:620:26: note: Loop condition is false.  Exiting loop
           struct pagevec *pvec = &per_cpu(lru_pvecs.lru_add, cpu);
                                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:622:6: note: Assuming the condition is false
           if (pagevec_count(pvec))
               ^~~~~~~~~~~~~~~~~~~
   mm/swap.c:622:2: note: Taking false branch
           if (pagevec_count(pvec))
           ^
   mm/swap.c:625:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_rotate.pvec, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:627:6: note: Assuming the condition is false
           if (data_race(pagevec_count(pvec))) {
               ^
   include/linux/compiler.h:204:31: note: expanded from macro 'data_race'
   #define data_race(expr)                                                 \
                                                                           ^
   mm/swap.c:627:2: note: Taking false branch
           if (data_race(pagevec_count(pvec))) {
           ^
   mm/swap.c:636:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_pvecs.lru_deactivate_file, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'

vim +870 include/linux/mmzone.h

7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  866  
599d0c954f91d0 Mel Gorman            2016-07-28  867  static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec)
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  868  {
c255a458055e45 Andrew Morton         2012-07-31  869  #ifdef CONFIG_MEMCG
599d0c954f91d0 Mel Gorman            2016-07-28 @870  	return lruvec->pgdat;
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  871  #else
867e5e1de14b2b Johannes Weiner       2019-11-30  872  	return container_of(lruvec, struct pglist_data, __lruvec);
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  873  #endif
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  874  }
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  875  

:::::: The code at line 870 was first introduced by commit
:::::: 599d0c954f91d0689c9bb421b5bc04ea02437a41 mm, vmscan: move LRU lists to node

:::::: TO: Mel Gorman <mgorman@techsingularity.net>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26948 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
@ 2021-08-20 12:42 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-20 12:42 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 26709 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alex Shi <alex.shi@linux.alibaba.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d992fe5318d8d7af9510b879439a3c7f283da442
commit: 6168d0da2b479ce25a4647de194045de1bdd1f1d mm/lru: replace pgdat lru_lock with lruvec lock
date:   8 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 8 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6168d0da2b479ce25a4647de194045de1bdd1f1d
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6168d0da2b479ce25a4647de194045de1bdd1f1d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   drivers/base/cacheinfo.c:271:3: note: Value assigned to 'this_leaf'
                   this_leaf = this_cpu_ci->info_list + index;
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/cacheinfo.c:272:3: note: Loop condition is true.  Entering loop body
                   for_each_cpu(sibling, &this_leaf->shared_cpu_map) {
                   ^
   include/linux/cpumask.h:208:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   drivers/base/cacheinfo.c:275:8: note: 'sibling' is not equal to 'cpu'
                           if (sibling == cpu) /* skip itself */
                               ^~~~~~~
   drivers/base/cacheinfo.c:275:4: note: Taking false branch
                           if (sibling == cpu) /* skip itself */
                           ^
   drivers/base/cacheinfo.c:279:8: note: Assuming field 'info_list' is null
                           if (!sib_cpu_ci->info_list)
                               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/base/cacheinfo.c:279:4: note: Taking true branch
                           if (!sib_cpu_ci->info_list)
                           ^
   drivers/base/cacheinfo.c:280:5: note:  Execution continues on line 272
                                   continue;
                                   ^
   drivers/base/cacheinfo.c:272:3: note: Loop condition is false. Execution continues on line 286
                   for_each_cpu(sibling, &this_leaf->shared_cpu_map) {
                   ^
   include/linux/cpumask.h:208:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
           ^
   drivers/base/cacheinfo.c:286:7: note: Calling 'of_have_populated_dt'
                   if (of_have_populated_dt())
                       ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/of.h:180:9: note: Assuming 'of_root' is not equal to NULL
           return of_root != NULL;
                  ^~~~~~~~~~~~~~~
   include/linux/of.h:180:2: note: Returning the value 1, which participates in a condition later
           return of_root != NULL;
           ^~~~~~~~~~~~~~~~~~~~~~
   drivers/base/cacheinfo.c:286:7: note: Returning from 'of_have_populated_dt'
                   if (of_have_populated_dt())
                       ^~~~~~~~~~~~~~~~~~~~~~
   drivers/base/cacheinfo.c:286:3: note: Taking true branch
                   if (of_have_populated_dt())
                   ^
   drivers/base/cacheinfo.c:287:16: note: Access to field 'fw_token' results in a dereference of a null pointer (loaded from variable 'this_leaf')
                           of_node_put(this_leaf->fw_token);
                                       ^~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
   mm/oom_kill.c:257:17: warning: Value stored to 'highest_zoneidx' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   mm/oom_kill.c:257:17: note: Value stored to 'highest_zoneidx' during its initialization is never read
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
   mm/page-writeback.c:1408:14: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/page-writeback.c:1407:6: note: Assuming 'thresh' is > 'dirty'
           if (thresh > dirty)
               ^~~~~~~~~~~~~~
   mm/page-writeback.c:1407:2: note: Taking true branch
           if (thresh > dirty)
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is false
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is true
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:160:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   mm/page-writeback.c:1408:14: note: The result of the left shift is undefined because the right operand is negative
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/swap.c:851:2: note: Calling 'lru_add_drain'
           lru_add_drain();
           ^~~~~~~~~~~~~~~
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:58:3: note: expanded from macro '__local_lock'
                   preempt_disable();                              \
                   ^
   include/linux/preempt.h:169:27: note: expanded from macro 'preempt_disable'
   #define preempt_disable() \
                             ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:59:22: note: expanded from macro '__local_lock'
                   local_lock_acquire(this_cpu_ptr(lock));         \
                                      ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)
                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:57:2: note: expanded from macro '__local_lock'
           do {                                                    \
           ^
   mm/swap.c:727:2: note: Calling 'lru_add_drain_cpu'
           lru_add_drain_cpu(smp_processor_id());
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/swap.c:620:26: note: Loop condition is false.  Exiting loop
           struct pagevec *pvec = &per_cpu(lru_pvecs.lru_add, cpu);
                                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:622:6: note: Assuming the condition is false
           if (pagevec_count(pvec))
               ^~~~~~~~~~~~~~~~~~~
   mm/swap.c:622:2: note: Taking false branch
           if (pagevec_count(pvec))
           ^
   mm/swap.c:625:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_rotate.pvec, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:627:6: note: Assuming the condition is false
           if (data_race(pagevec_count(pvec))) {
               ^
   include/linux/compiler.h:204:31: note: expanded from macro 'data_race'
   #define data_race(expr)                                                 \
                                                                           ^
   mm/swap.c:627:2: note: Taking false branch
           if (data_race(pagevec_count(pvec))) {
           ^
   mm/swap.c:636:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_pvecs.lru_deactivate_file, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
--
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:545:28: note: expanded from macro 'list_first_entry_or_null'
           struct list_head *pos__ = READ_ONCE(head__->next); \
                                     ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
           ^
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/base/regmap/regmap.c:1486:11: note: Assuming 'pos__' is not equal to 'head__'
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:546:2: note: expanded from macro 'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
           ^~~~~~~~~~~~~~~
   drivers/base/regmap/regmap.c:1486:11: note: '?' condition is true
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:546:2: note: expanded from macro 'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
           ^
   drivers/base/regmap/regmap.c:1486:11: note: Left side of '&&' is false
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:546:20: note: expanded from macro 'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
                             ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:861:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/base/regmap/regmap.c:1486:11: note: Taking false branch
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:546:20: note: expanded from macro 'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
                             ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:861:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/base/regmap/regmap.c:1486:11: note: Loop condition is false.  Exiting loop
                   async = list_first_entry_or_null(&map->async_free,
                           ^
   include/linux/list.h:546:20: note: expanded from macro 'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
                             ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:861:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/base/regmap/regmap.c:1489:3: note: Calling 'list_del'
                   list_del(&async->list);
                   ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:147:14: note: Use of memory after it is freed
           entry->next = LIST_POISON1;
           ~~~~~~~~~~~ ^
   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.
   4 warnings generated.
   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.
   7 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/vmscan.c:4268:2: note: 'lruvec' initialized to a null pointer value
           struct lruvec *lruvec = NULL;
           ^~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4273:14: note: Assuming 'i' is < field 'nr'
           for (i = 0; i < pvec->nr; i++) {
                       ^~~~~~~~~~~~
   mm/vmscan.c:4273:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < pvec->nr; i++) {
           ^
   mm/vmscan.c:4278:7: note: Calling 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:698:1: note: Returning zero, which participates in a condition later
   TESTPAGEFLAG_FALSE(TransTail)
   ^
   include/linux/page-flags.h:305:58: note: expanded from macro 'TESTPAGEFLAG_FALSE'
   static inline int Page##uname(const struct page *page) { return 0; }
                                                            ^~~~~~~~
   mm/vmscan.c:4278:7: note: Returning from 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4278:3: note: Taking false branch
                   if (PageTransTail(page))
                   ^
   mm/vmscan.c:4285:8: note: Calling 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: '?' condition is true
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^
   arch/arm/include/asm/bitops.h:181:3: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
            ^
   include/linux/page-flags.h:337:2: note: Calling '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   arch/arm/include/asm/bitops.h:98:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_save(flags);
           ^
   include/linux/irqflags.h:158:2: note: expanded from macro 'raw_local_irq_save'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:101:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_restore(flags);
           ^
   include/linux/irqflags.h:163:2: note: expanded from macro 'raw_local_irq_restore'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:103:9: note: Assuming the condition is true
           return (res & mask) != 0;
                  ^~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:103:2: note: Returning the value 1, which participates in a condition later
           return (res & mask) != 0;
           ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: Returning from '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/page-flags.h:337:2: note: Returning the value 1, which participates in a condition later
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:4: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:8: note: Returning from 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:3: note: Taking false branch
                   if (!TestClearPageLRU(page))
                   ^
   mm/vmscan.c:4289:7: note: Assuming 'lruvec' is equal to 'new_lruvec'
                   if (lruvec != new_lruvec) {
                       ^~~~~~~~~~~~~~~~~~~~

vim +870 include/linux/mmzone.h

7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  866  
599d0c954f91d0 Mel Gorman            2016-07-28  867  static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec)
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  868  {
c255a458055e45 Andrew Morton         2012-07-31  869  #ifdef CONFIG_MEMCG
599d0c954f91d0 Mel Gorman            2016-07-28 @870  	return lruvec->pgdat;
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  871  #else
867e5e1de14b2b Johannes Weiner       2019-11-30  872  	return container_of(lruvec, struct pglist_data, __lruvec);
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  873  #endif
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  874  }
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  875  

:::::: The code at line 870 was first introduced by commit
:::::: 599d0c954f91d0689c9bb421b5bc04ea02437a41 mm, vmscan: move LRU lists to node

:::::: TO: Mel Gorman <mgorman@techsingularity.net>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26948 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
@ 2021-08-28 19:52 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-28 19:52 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 28713 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alex Shi <alex.shi@linux.alibaba.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   64b4fc45bea6f4faa843d2f97ff51665280efee1
commit: 6168d0da2b479ce25a4647de194045de1bdd1f1d mm/lru: replace pgdat lru_lock with lruvec lock
date:   9 months ago
:::::: branch date: 21 hours ago
:::::: commit date: 9 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6168d0da2b479ce25a4647de194045de1bdd1f1d
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6168d0da2b479ce25a4647de194045de1bdd1f1d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:224:7: note: The value 0 is assigned to 'row'
           for (row = 0; row < kp->num_rows; row++) {
                ^~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:224:16: note: Assuming 'row' is < field 'num_rows'
           for (row = 0; row < kp->num_rows; row++) {
                         ^~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:224:2: note: Loop condition is true.  Entering loop body
           for (row = 0; row < kp->num_rows; row++) {
           ^
   drivers/input/keyboard/pmic8xxx-keypad.c:225:37: note: The left operand of '^' is a garbage value
                   int bits_changed = new_state[row] ^ old_state[row];
                                      ~~~~~~~~~~~~~~ ^
   drivers/input/keyboard/pmic8xxx-keypad.c:257:33: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   row_state = (~new_state[row]) &
                                                 ^
   drivers/input/keyboard/pmic8xxx-keypad.c:352:6: note: Assuming 'rc' is >= 0
           if (rc < 0) {
               ^~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:352:2: note: Taking false branch
           if (rc < 0) {
           ^
   drivers/input/keyboard/pmic8xxx-keypad.c:359:7: note: Calling 'pmic8xxx_kp_scan_matrix'
           rc = pmic8xxx_kp_scan_matrix(kp, events);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:280:2: note: Control jumps to 'case 1:' @line 281
           switch (events) {
           ^
   drivers/input/keyboard/pmic8xxx-keypad.c:283:7: note: 'rc' is >= 0
                   if (rc < 0)
                       ^~
   drivers/input/keyboard/pmic8xxx-keypad.c:283:3: note: Taking false branch
                   if (rc < 0)
                   ^
   drivers/input/keyboard/pmic8xxx-keypad.c:287:7: note: Calling 'pmic8xxx_detect_ghost_keys'
                   if (pmic8xxx_detect_ghost_keys(kp, new_state))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:256:16: note: Assuming 'row' is < field 'num_rows'
           for (row = 0; row < kp->num_rows; row++) {
                         ^~~~~~~~~~~~~~~~~~
   drivers/input/keyboard/pmic8xxx-keypad.c:256:2: note: Loop condition is true.  Entering loop body
           for (row = 0; row < kp->num_rows; row++) {
           ^
   drivers/input/keyboard/pmic8xxx-keypad.c:257:33: note: The left operand of '&' is a garbage value
                   row_state = (~new_state[row]) &
                                ~~~~~~~~~~~~~~~  ^
   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.
   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.
   6 warnings generated.
   init/do_mounts.c:280: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(s, name);
           ^~~~~~
   init/do_mounts.c:280: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(s, name);
           ^~~~~~
   init/do_mounts.c:367:3: 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(page, root_fs_names);
                   ^~~~~~
   init/do_mounts.c:367:3: 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(page, root_fs_names);
                   ^~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
   init/initramfs.c:88: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(q->name, name);
           ^~~~~~
   init/initramfs.c:88: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(q->name, name);
           ^~~~~~
   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.
   3 warnings generated.
   Suppressed 3 warnings (2 in non-user code, 1 with check filters).
   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.
   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.
   4 warnings generated.
   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.
   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.
   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.
   4 warnings generated.
   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.
   7 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/vmscan.c:4268:2: note: 'lruvec' initialized to a null pointer value
           struct lruvec *lruvec = NULL;
           ^~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4273:14: note: Assuming 'i' is < field 'nr'
           for (i = 0; i < pvec->nr; i++) {
                       ^~~~~~~~~~~~
   mm/vmscan.c:4273:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < pvec->nr; i++) {
           ^
   mm/vmscan.c:4278:7: note: Calling 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:698:1: note: Returning zero, which participates in a condition later
   TESTPAGEFLAG_FALSE(TransTail)
   ^
   include/linux/page-flags.h:305:58: note: expanded from macro 'TESTPAGEFLAG_FALSE'
   static inline int Page##uname(const struct page *page) { return 0; }
                                                            ^~~~~~~~
   mm/vmscan.c:4278:7: note: Returning from 'PageTransTail'
                   if (PageTransTail(page))
                       ^~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4278:3: note: Taking false branch
                   if (PageTransTail(page))
                   ^
   mm/vmscan.c:4285:8: note: Calling 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: '?' condition is true
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^
   arch/arm/include/asm/bitops.h:181:3: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
            ^
   include/linux/page-flags.h:337:2: note: Calling '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   arch/arm/include/asm/bitops.h:98:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_save(flags);
           ^
   include/linux/irqflags.h:158:2: note: expanded from macro 'raw_local_irq_save'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:101:2: note: Loop condition is false.  Exiting loop
           raw_local_irq_restore(flags);
           ^
   include/linux/irqflags.h:163:2: note: expanded from macro 'raw_local_irq_restore'
           do {                                            \
           ^
   arch/arm/include/asm/bitops.h:103:9: note: Assuming the condition is true
           return (res & mask) != 0;
                  ^~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:103:2: note: Returning the value 1, which participates in a condition later
           return (res & mask) != 0;
           ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:337:2: note: Returning from '____atomic_test_and_clear_bit'
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:11: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:193:34: note: expanded from macro 'test_and_clear_bit'
   #define test_and_clear_bit(nr,p)        ATOMIC_BITOP(test_and_clear_bit,nr,p)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:30: note: expanded from macro 'ATOMIC_BITOP'
           (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
                                       ^~~~~~~~~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/page-flags.h:337:2: note: Returning the value 1, which participates in a condition later
           TESTCLEARFLAG(LRU, lru, PF_HEAD)
           ^
   include/linux/page-flags.h:288:4: note: expanded from macro 'TESTCLEARFLAG'
           { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:8: note: Returning from 'TestClearPageLRU'
                   if (!TestClearPageLRU(page))
                        ^~~~~~~~~~~~~~~~~~~~~~
   mm/vmscan.c:4285:3: note: Taking false branch
                   if (!TestClearPageLRU(page))
                   ^
   mm/vmscan.c:4289:7: note: Assuming 'lruvec' is equal to 'new_lruvec'
                   if (lruvec != new_lruvec) {
                       ^~~~~~~~~~~~~~~~~~~~
--
   4 warnings generated.
   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.
   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.
   4 warnings generated.
   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.
   4 warnings generated.
   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.
   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.
   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.
   4 warnings generated.
   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.
   4 warnings generated.
   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.
   4 warnings generated.
   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.
   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.
   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.
   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.
   5 warnings generated.
   mm/oom_kill.c:257:17: warning: Value stored to 'highest_zoneidx' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   mm/oom_kill.c:257:17: note: Value stored to 'highest_zoneidx' during its initialization is never read
           enum zone_type highest_zoneidx = gfp_zone(oc->gfp_mask);
                          ^~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
   mm/page-writeback.c:1408:14: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/page-writeback.c:1407:6: note: Assuming 'thresh' is > 'dirty'
           if (thresh > dirty)
               ^~~~~~~~~~~~~~
   mm/page-writeback.c:1407:2: note: Taking true branch
           if (thresh > dirty)
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is false
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   mm/page-writeback.c:1408:18: note: '?' condition is true
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                                  ^
   include/linux/log2.h:160:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   mm/page-writeback.c:1408:14: note: The result of the left shift is undefined because the right operand is negative
                   return 1UL << (ilog2(thresh - dirty) >> 1);
                              ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   4 warnings generated.
   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.
   5 warnings generated.
>> include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference]
           return lruvec->pgdat;
                  ^
   mm/swap.c:851:2: note: Calling 'lru_add_drain'
           lru_add_drain();
           ^~~~~~~~~~~~~~~
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:58:3: note: expanded from macro '__local_lock'
                   preempt_disable();                              \
                   ^
   include/linux/preempt.h:169:27: note: expanded from macro 'preempt_disable'
   #define preempt_disable() \
                             ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:59:22: note: expanded from macro '__local_lock'
                   local_lock_acquire(this_cpu_ptr(lock));         \
                                      ^
   include/linux/percpu-defs.h:265:27: note: expanded from macro 'this_cpu_ptr'
   #define this_cpu_ptr(ptr)       raw_cpu_ptr(ptr)
                                   ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:726:2: note: Loop condition is false.  Exiting loop
           local_lock(&lru_pvecs.lock);
           ^
   include/linux/local_lock.h:16:27: note: expanded from macro 'local_lock'
   #define local_lock(lock)                __local_lock(lock)
                                           ^
   include/linux/local_lock_internal.h:57:2: note: expanded from macro '__local_lock'
           do {                                                    \
           ^
   mm/swap.c:727:2: note: Calling 'lru_add_drain_cpu'
           lru_add_drain_cpu(smp_processor_id());
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/swap.c:620:26: note: Loop condition is false.  Exiting loop
           struct pagevec *pvec = &per_cpu(lru_pvecs.lru_add, cpu);
                                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:622:6: note: Assuming the condition is false
           if (pagevec_count(pvec))
               ^~~~~~~~~~~~~~~~~~~
   mm/swap.c:622:2: note: Taking false branch
           if (pagevec_count(pvec))
           ^
   mm/swap.c:625:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_rotate.pvec, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'
   #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
                                     ^
   include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
   #define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
                                                   ^
   include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
           __verify_pcpu_ptr(__p);                                         \
           ^
   include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
   #define __verify_pcpu_ptr(ptr)                                          \
                                                                           ^
   mm/swap.c:627:6: note: Assuming the condition is false
           if (data_race(pagevec_count(pvec))) {
               ^
   include/linux/compiler.h:204:31: note: expanded from macro 'data_race'
   #define data_race(expr)                                                 \
                                                                           ^
   mm/swap.c:627:2: note: Taking false branch
           if (data_race(pagevec_count(pvec))) {
           ^
   mm/swap.c:636:10: note: Loop condition is false.  Exiting loop
           pvec = &per_cpu(lru_pvecs.lru_deactivate_file, cpu);
                   ^
   include/linux/percpu-defs.h:269:29: note: expanded from macro 'per_cpu'

vim +870 include/linux/mmzone.h

7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  866  
599d0c954f91d0 Mel Gorman            2016-07-28  867  static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec)
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  868  {
c255a458055e45 Andrew Morton         2012-07-31  869  #ifdef CONFIG_MEMCG
599d0c954f91d0 Mel Gorman            2016-07-28 @870  	return lruvec->pgdat;
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  871  #else
867e5e1de14b2b Johannes Weiner       2019-11-30  872  	return container_of(lruvec, struct pglist_data, __lruvec);
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  873  #endif
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  874  }
7f5e86c2ccc148 Konstantin Khlebnikov 2012-05-29  875  

:::::: The code at line 870 was first introduced by commit
:::::: 599d0c954f91d0689c9bb421b5bc04ea02437a41 mm, vmscan: move LRU lists to node

:::::: TO: Mel Gorman <mgorman@techsingularity.net>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26948 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-28 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-17  6:25 include/linux/mmzone.h:870:9: warning: Access to field 'pgdat' results in a dereference of a null pointer (loaded from variable 'lruvec') [clang-analyzer-core.NullDereference] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-08-20 12:42 kernel test robot
2021-08-28 19:52 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.