All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [arm-de:eas/next/integration-20210823+ 120/126] drivers/cpufreq/freq_table.c:397:20: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
Date: Sun, 07 Nov 2021 14:18:56 +0800	[thread overview]
Message-ID: <202111071440.ABNFbE6P-lkp@intel.com> (raw)

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Vincent Donnefort <vincent.donnefort@arm.com>
CC: Deepak Kumar Mishra <deepakkumar.mishra@arm.com>

tree:   https://git.gitlab.arm.com/linux-arm/linux-de.git eas/next/integration-20210823+
head:   8ec94141c9825682324f96b4abb80b66dccf1a49
commit: 20c0d33c8dc4e6343f969ac290284fd1bb1c269b [120/126] cpufreq: Add an interface to mark inefficient frequencies
:::::: branch date: 6 weeks ago
:::::: commit date: 2 months ago
config: arm-randconfig-c002-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
        git remote add arm-de https://git.gitlab.arm.com/linux-arm/linux-de.git
        git fetch --no-tags arm-de eas/next/integration-20210823+
        git checkout 20c0d33c8dc4e6343f969ac290284fd1bb1c269b
        # 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 >>)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^~~~~~~~~~
   mm/page_alloc.c:8735:8: note: '?' condition is false
           max = min(max, 0x80000000ULL);
                 ^
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^
   include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^
   include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^
   mm/page_alloc.c:8737:6: note: Assuming 'numentries' is >= 'low_limit'
           if (numentries < low_limit)
               ^~~~~~~~~~~~~~~~~~~~~~
   mm/page_alloc.c:8737:2: note: Taking false branch
           if (numentries < low_limit)
           ^
   mm/page_alloc.c:8739:6: note: Assuming 'numentries' is <= 'max'
           if (numentries > max)
               ^~~~~~~~~~~~~~~~
   mm/page_alloc.c:8739:2: note: Taking false branch
           if (numentries > max)
           ^
   mm/page_alloc.c:8742:12: note: '?' condition is false
           log2qty = ilog2(numentries);
                     ^
   include/linux/log2.h:158:2: note: expanded from macro 'ilog2'
           __builtin_constant_p(n) ?       \
           ^
   mm/page_alloc.c:8742:12: note: '?' condition is true
           log2qty = ilog2(numentries);
                     ^
   include/linux/log2.h:161:2: note: expanded from macro 'ilog2'
           (sizeof(n) <= 4) ?              \
           ^
   mm/page_alloc.c:8742:12: note: Calling '__ilog2_u32'
           log2qty = ilog2(numentries);
                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   include/linux/log2.h:24:2: note: Returning the value -1
           return fls(n) - 1;
           ^~~~~~~~~~~~~~~~~
   mm/page_alloc.c:8742:12: note: Returning from '__ilog2_u32'
           log2qty = ilog2(numentries);
                     ^
   include/linux/log2.h:162:2: note: expanded from macro 'ilog2'
           __ilog2_u32(n) :                \
           ^~~~~~~~~~~~~~
   mm/page_alloc.c:8742:2: note: The value 4294967295 is assigned to 'log2qty'
           log2qty = ilog2(numentries);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/page_alloc.c:8744:15: note: Assuming the condition is false
           gfp_flags = (flags & HASH_ZERO) ? GFP_ATOMIC | __GFP_ZERO : GFP_ATOMIC;
                        ^~~~~~~~~~~~~~~~~
   mm/page_alloc.c:8744:14: note: '?' condition is false
           gfp_flags = (flags & HASH_ZERO) ? GFP_ATOMIC | __GFP_ZERO : GFP_ATOMIC;
                       ^
   mm/page_alloc.c:8748:7: note: Assuming the condition is true
                   if (flags & HASH_EARLY) {
                       ^~~~~~~~~~~~~~~~~~
   mm/page_alloc.c:8748:3: note: Taking true branch
                   if (flags & HASH_EARLY) {
                   ^
   mm/page_alloc.c:8749:4: note: Taking false branch
                           if (flags & HASH_ZERO)
                           ^
   mm/page_alloc.c:8767:11: note: Assuming 'table' is non-null
           } while (!table && size > PAGE_SIZE && --log2qty);
                    ^~~~~~
   mm/page_alloc.c:8767:18: note: Left side of '&&' is false
           } while (!table && size > PAGE_SIZE && --log2qty);
                           ^
   mm/page_alloc.c:8745:2: note: Loop condition is false.  Exiting loop
           do {
           ^
   mm/page_alloc.c:8769:7: note: 'table' is non-null
           if (!table)
                ^~~~~
   mm/page_alloc.c:8769:2: note: Taking false branch
           if (!table)
           ^
   mm/page_alloc.c:8773:18: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
                   tablename, 1UL << log2qty, ilog2(size) - PAGE_SHIFT, size,
                                  ^
   include/linux/printk.h:420:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                           ^~~~~~~~~~~
   Suppressed 20 warnings (19 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.
>> drivers/cpufreq/freq_table.c:397:20: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                                   pos->efficient = efficient;
                                                  ^ ~~~~~~~~~
   drivers/cpufreq/freq_table.c:372:6: note: 'efficient' declared without an initial value
           int efficient, idx;
               ^~~~~~~~~
   drivers/cpufreq/freq_table.c:375:6: note: Assuming 'sort' is not equal to CPUFREQ_TABLE_UNSORTED
           if (sort == CPUFREQ_TABLE_UNSORTED) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cpufreq/freq_table.c:375:2: note: Taking false branch
           if (sort == CPUFREQ_TABLE_UNSORTED) {
           ^
   drivers/cpufreq/freq_table.c:382:29: note: Assuming the condition is false
           cpufreq_for_each_entry_idx(pos, table, idx) {
                                      ^
   include/linux/cpufreq.h:716:29: note: expanded from macro 'cpufreq_for_each_entry_idx'
           for (pos = table, idx = 0; pos->frequency != CPUFREQ_TABLE_END; \
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cpufreq/freq_table.c:382:2: note: Loop condition is false. Execution continues on line 392
           cpufreq_for_each_entry_idx(pos, table, idx) {
           ^
   include/linux/cpufreq.h:716:2: note: expanded from macro 'cpufreq_for_each_entry_idx'
           for (pos = table, idx = 0; pos->frequency != CPUFREQ_TABLE_END; \
           ^
   drivers/cpufreq/freq_table.c:392:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   drivers/cpufreq/freq_table.c:395:3: note: Taking true branch
                   if (pos->frequency != CPUFREQ_ENTRY_INVALID) {
                   ^
   drivers/cpufreq/freq_table.c:396:8: note: Assuming the condition is true
                           if (pos->flags & CPUFREQ_INEFFICIENT_FREQ) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/cpufreq/freq_table.c:396:4: note: Taking true branch
                           if (pos->flags & CPUFREQ_INEFFICIENT_FREQ) {
                           ^
   drivers/cpufreq/freq_table.c:397:20: note: Assigned value is garbage or undefined
                                   pos->efficient = efficient;
                                                  ^ ~~~~~~~~~
   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.
   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.
   19 warnings generated.
   Suppressed 19 warnings (19 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.
   18 warnings generated.
   Suppressed 18 warnings (18 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.
   20 warnings generated.
   fs/fuse/file.c:1392:44: warning: The left operand of '<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           while (nbytes < *nbytesp && ap->num_pages < max_pages) {
                                                     ^
   fs/fuse/file.c:1594:2: note: Taking false branch
           if (fuse_is_bad(inode))
           ^
   fs/fuse/file.c:1597:6: note: Left side of '&&' is false
           if (FUSE_IS_DAX(inode))
               ^
   fs/fuse/fuse_i.h:1239:57: note: expanded from macro 'FUSE_IS_DAX'
   #define FUSE_IS_DAX(inode) (IS_ENABLED(CONFIG_FUSE_DAX) && IS_DAX(inode))
                                                           ^
   fs/fuse/file.c:1600:6: note: Assuming the condition is false
           if (!(ff->open_flags & FOPEN_DIRECT_IO))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/file.c:1600:2: note: Taking false branch
           if (!(ff->open_flags & FOPEN_DIRECT_IO))
           ^
   fs/fuse/file.c:1603:10: note: Calling 'fuse_direct_write_iter'
                   return fuse_direct_write_iter(iocb, from);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/file.c:1554:6: note: Assuming 'res' is > 0
           if (res > 0) {
               ^~~~~~~
   fs/fuse/file.c:1554:2: note: Taking true branch
           if (res > 0) {
           ^
   fs/fuse/file.c:1555:7: note: Left side of '&&' is true
                   if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
                       ^
   fs/fuse/file.c:1555:31: note: Assuming the condition is true
                   if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/file.c:1555:3: note: Taking true branch
                   if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
                   ^
   fs/fuse/file.c:1556:10: note: Calling 'fuse_direct_IO'
                           res = fuse_direct_IO(iocb, from);

vim +397 drivers/cpufreq/freq_table.c

d417e0691ac00d Viresh Kumar      2018-02-22  367  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  368  void cpufreq_table_update_efficiencies(struct cpufreq_policy *policy)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  369  {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  370  	struct cpufreq_frequency_table *pos, *table = policy->freq_table;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  371  	enum cpufreq_table_sorting sort = policy->freq_table_sorted;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  372  	int efficient, idx;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  373  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  374  	/* Not supported */
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  375  	if (sort == CPUFREQ_TABLE_UNSORTED) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  376  		cpufreq_for_each_entry_idx(pos, table, idx)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  377  			pos->efficient = idx;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  378  		return;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  379  	}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  380  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  381  	/* The highest frequency is always efficient */
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  382  	cpufreq_for_each_entry_idx(pos, table, idx) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  383  		if (pos->frequency == CPUFREQ_ENTRY_INVALID)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  384  			continue;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  385  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  386  		efficient = idx;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  387  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  388  		if (sort == CPUFREQ_TABLE_SORTED_DESCENDING)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  389  			break;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  390  	}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  391  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  392  	for (;;) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  393  		pos = &table[idx];
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  394  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  395  		if (pos->frequency != CPUFREQ_ENTRY_INVALID) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  396  			if (pos->flags & CPUFREQ_INEFFICIENT_FREQ) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02 @397  				pos->efficient = efficient;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  398  			} else {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  399  				pos->efficient = idx;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  400  				efficient = idx;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  401  			}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  402  		}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  403  
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  404  		if (sort == CPUFREQ_TABLE_SORTED_ASCENDING) {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  405  			if (--idx < 0)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  406  				break;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  407  		} else {
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  408  			if (table[++idx].frequency == CPUFREQ_TABLE_END)
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  409  				break;
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  410  		}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  411  	}
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  412  }
20c0d33c8dc4e6 Vincent Donnefort 2021-06-02  413  

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

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

                 reply	other threads:[~2021-11-07  6:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202111071440.ABNFbE6P-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.