All of lore.kernel.org
 help / color / mirror / Atom feed
* fs/verity/read_metadata.c:38:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
@ 2022-01-09  5:19 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-01-09  5:19 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Eric Biggers <ebiggers@google.com>
CC: Victor Hsieh <victorhsieh@google.com>
CC: Chao Yu <yuchao0@huawei.com>, Chao Yu <chao@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4634129ad9fdc89d10b597fc6f8f4336fb61e105
commit: e17fe6579de023725ec22a16965e9099e4a05ac9 fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl
date:   11 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 11 months ago
config: mips-randconfig-c004-20211227 (https://download.01.org/0day-ci/archive/20220109/202201091339.c3DpKgU6-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 511726c64d3b6cca66f7c54d457d586aa3129f67)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e17fe6579de023725ec22a16965e9099e4a05ac9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e17fe6579de023725ec22a16965e9099e4a05ac9
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 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 >>)
           ^
   fs/verity/open.c:50:2: note: Taking false branch
           if (IS_ERR(params->hashstate)) {
           ^
   fs/verity/open.c:57:6: note: Assuming 'log_blocksize' is not equal to PAGE_SHIFT
           if (log_blocksize != PAGE_SHIFT) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/verity/open.c:57:2: note: Taking true branch
           if (log_blocksize != PAGE_SHIFT) {
           ^
   fs/verity/open.c:61:3: note: Control jumps to line 121
                   goto out_err;
                   ^
   fs/verity/open.c:121:2: note: Memory is released
           kfree(params->hashstate);
           ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/verity/open.c:161:8: note: Returning; memory was released
           err = fsverity_init_merkle_tree_params(&vi->tree_params, inode,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/verity/open.c:165:6: note: 'err' is -22
           if (err) {
               ^~~
   fs/verity/open.c:165:2: note: Taking true branch
           if (err) {
           ^
   fs/verity/open.c:169:3: note: Control jumps to line 187
                   goto out;
                   ^
   fs/verity/open.c:187:6: note: 'err' is -22
           if (err) {
               ^~~
   fs/verity/open.c:187:2: note: Taking true branch
           if (err) {
           ^
   fs/verity/open.c:188:3: note: Calling 'fsverity_free_info'
                   fsverity_free_info(vi);
                   ^~~~~~~~~~~~~~~~~~~~~~
   fs/verity/open.c:215:7: note: 'vi' is non-null
           if (!vi)
                ^~
   fs/verity/open.c:215:2: note: Taking false branch
           if (!vi)
           ^
   fs/verity/open.c:217:2: note: Attempt to free released memory
           kfree(vi->tree_params.hashstate);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 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.
   init/main.c:640: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(saved_command_line, extra_command_line);
                   ^~~~~~
   init/main.c:640: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(saved_command_line, extra_command_line);
                   ^~~~~~
   init/main.c:641: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(static_command_line, extra_command_line);
                   ^~~~~~
   init/main.c:641: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(static_command_line, extra_command_line);
                   ^~~~~~
   init/main.c:643: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(saved_command_line + xlen, boot_command_line);
           ^~~~~~
   init/main.c:643: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(saved_command_line + xlen, boot_command_line);
           ^~~~~~
   init/main.c:644: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(static_command_line + xlen, command_line);
           ^~~~~~
   init/main.c:644: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(static_command_line + xlen, command_line);
           ^~~~~~
   init/main.c:656:4: 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(saved_command_line + len, " -- ");
                           ^~~~~~
   init/main.c:656:4: 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(saved_command_line + len, " -- ");
                           ^~~~~~
   init/main.c:660: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(saved_command_line + len, extra_init_args);
                   ^~~~~~
   init/main.c:660: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(saved_command_line + len, extra_init_args);
                   ^~~~~~
   init/main.c:1105:4: 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(entry->buf, str_entry);
                           ^~~~~~
   init/main.c:1105:4: 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(entry->buf, str_entry);
                           ^~~~~~
   init/main.c:1305: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(command_line, saved_command_line);
                   ^~~~~~
   init/main.c:1305: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(command_line, saved_command_line);
                   ^~~~~~
   Suppressed 10 warnings (5 in non-user code, 5 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.
   6 warnings generated.
>> fs/verity/read_metadata.c:38:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (arg.__reserved)
               ^~~~~~~~~~~~~~
   fs/verity/read_metadata.c:27:7: note: Calling 'fsverity_get_info'
           vi = fsverity_get_info(inode);
                ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is true
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:283:28: note: expanded from macro '__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   include/linux/fsverity.h:124:9: note: Taking false branch
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   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:320:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/fsverity.h:124:9: note: Loop condition is false.  Exiting loop
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   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:320:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:298:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:172:2: note: expanded from macro 'smp_load_acquire'
           compiletime_assert_atomic_type(*p);                             \
           ^
   include/linux/compiler_types.h:323:21: note: expanded from macro 'compiletime_assert_atomic_type'
           compiletime_assert(__native_word(t),                            \

vim +38 fs/verity/read_metadata.c

e17fe6579de0237 Eric Biggers 2021-01-15  11  
e17fe6579de0237 Eric Biggers 2021-01-15  12  /**
e17fe6579de0237 Eric Biggers 2021-01-15  13   * fsverity_ioctl_read_metadata() - read verity metadata from a file
e17fe6579de0237 Eric Biggers 2021-01-15  14   * @filp: file to read the metadata from
e17fe6579de0237 Eric Biggers 2021-01-15  15   * @uarg: user pointer to fsverity_read_metadata_arg
e17fe6579de0237 Eric Biggers 2021-01-15  16   *
e17fe6579de0237 Eric Biggers 2021-01-15  17   * Return: length read on success, 0 on EOF, -errno on failure
e17fe6579de0237 Eric Biggers 2021-01-15  18   */
e17fe6579de0237 Eric Biggers 2021-01-15  19  int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg)
e17fe6579de0237 Eric Biggers 2021-01-15  20  {
e17fe6579de0237 Eric Biggers 2021-01-15  21  	struct inode *inode = file_inode(filp);
e17fe6579de0237 Eric Biggers 2021-01-15  22  	const struct fsverity_info *vi;
e17fe6579de0237 Eric Biggers 2021-01-15  23  	struct fsverity_read_metadata_arg arg;
e17fe6579de0237 Eric Biggers 2021-01-15  24  	int length;
e17fe6579de0237 Eric Biggers 2021-01-15  25  	void __user *buf;
e17fe6579de0237 Eric Biggers 2021-01-15  26  
e17fe6579de0237 Eric Biggers 2021-01-15  27  	vi = fsverity_get_info(inode);
e17fe6579de0237 Eric Biggers 2021-01-15  28  	if (!vi)
e17fe6579de0237 Eric Biggers 2021-01-15  29  		return -ENODATA; /* not a verity file */
e17fe6579de0237 Eric Biggers 2021-01-15  30  	/*
e17fe6579de0237 Eric Biggers 2021-01-15  31  	 * Note that we don't have to explicitly check that the file is open for
e17fe6579de0237 Eric Biggers 2021-01-15  32  	 * reading, since verity files can only be opened for reading.
e17fe6579de0237 Eric Biggers 2021-01-15  33  	 */
e17fe6579de0237 Eric Biggers 2021-01-15  34  
e17fe6579de0237 Eric Biggers 2021-01-15  35  	if (copy_from_user(&arg, uarg, sizeof(arg)))
e17fe6579de0237 Eric Biggers 2021-01-15  36  		return -EFAULT;
e17fe6579de0237 Eric Biggers 2021-01-15  37  
e17fe6579de0237 Eric Biggers 2021-01-15 @38  	if (arg.__reserved)

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

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

* fs/verity/read_metadata.c:38:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
@ 2021-08-28 21:44 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-28 21:44 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Eric Biggers <ebiggers@google.com>
CC: Victor Hsieh <victorhsieh@google.com>
CC: Chao Yu <yuchao0@huawei.com>, Chao Yu <chao@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   64b4fc45bea6f4faa843d2f97ff51665280efee1
commit: e17fe6579de023725ec22a16965e9099e4a05ac9 fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl
date:   7 months ago
:::::: branch date: 23 hours ago
:::::: commit date: 7 months ago
config: mips-randconfig-c004-20210824 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d26000e4cc2bc65e207a84fa26cb6e374d60aa12)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e17fe6579de023725ec22a16965e9099e4a05ac9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e17fe6579de023725ec22a16965e9099e4a05ac9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 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 >>)
           ^
   arch/mips/include/asm/uaccess.h:619:3: note: Returning without writing to 'to->nr_filters'
                   return __invoke_copy_from_user(to, from, n);
                   ^
   include/linux/uaccess.h:159:9: note: Returning from 'raw_copy_from_user'
                   res = raw_copy_from_user(to, from, n);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:161:6: note: Assuming 'res' is 0
           if (unlikely(res))
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   include/linux/uaccess.h:161:2: note: Taking false branch
           if (unlikely(res))
           ^
   include/linux/uaccess.h:163:2: note: Returning without writing to 'to->nr_filters'
           return res;
           ^
   include/linux/uaccess.h:192:7: note: Returning from '_copy_from_user'
                   n = _copy_from_user(to, from, n);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:193:2: note: Returning without writing to 'to->nr_filters'
           return n;
           ^
   kernel/watch_queue.c:306:6: note: Returning from 'copy_from_user'
           if (copy_from_user(&filter, _filter, sizeof(filter)) != 0)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/watch_queue.c:306:2: note: Taking false branch
           if (copy_from_user(&filter, _filter, sizeof(filter)) != 0)
           ^
   kernel/watch_queue.c:308:24: note: The left operand of '==' is a garbage value
           if (filter.nr_filters == 0 ||
               ~~~~~~~~~~~~~~~~~ ^
   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.
   arch/mips/kernel/segment.c:45:2: warning: Value stored to 'str' is never read [clang-analyzer-deadcode.DeadStores]
           str += sprintf(str, "       %01ld\n",
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/kernel/segment.c:45:2: note: Value stored to 'str' is never read
           str += sprintf(str, "       %01ld\n",
           ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   arch/mips/kernel/stacktrace.c:40:2: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           unsigned long sp = regs->regs[29];
           ^
   arch/mips/kernel/stacktrace.c:74:2: note: Calling 'save_stack_trace_tsk'
           save_stack_trace_tsk(current, trace);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/kernel/stacktrace.c:83:10: note: Assuming field 'nr_entries' is 0
           WARN_ON(trace->nr_entries || !trace->max_entries);
                   ^
   include/asm-generic/bug.h:119:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   arch/mips/kernel/stacktrace.c:83:10: note: Left side of '||' is false
           WARN_ON(trace->nr_entries || !trace->max_entries);
                   ^
   arch/mips/kernel/stacktrace.c:83:31: note: Assuming field 'max_entries' is not equal to 0
           WARN_ON(trace->nr_entries || !trace->max_entries);
                                        ^
   include/asm-generic/bug.h:119:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   arch/mips/kernel/stacktrace.c:83:2: note: Taking false branch
           WARN_ON(trace->nr_entries || !trace->max_entries);
           ^
   include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   arch/mips/kernel/stacktrace.c:85:6: note: 'tsk' is equal to field 'task'
           if (tsk != current) {
               ^~~
   arch/mips/kernel/stacktrace.c:85:2: note: Taking false branch
           if (tsk != current) {
           ^
   arch/mips/kernel/stacktrace.c:90:3: note: Calling 'prepare_frametrace'
                   prepare_frametrace(regs);
                   ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/kernel/stacktrace.c:90:3: note: Returning from 'prepare_frametrace'
                   prepare_frametrace(regs);
                   ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/kernel/stacktrace.c:91:2: note: Calling 'save_context_stack'
           save_context_stack(trace, tsk, regs, tsk == current);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/mips/kernel/stacktrace.c:40:2: note: Assigned value is garbage or undefined
           unsigned long sp = regs->regs[29];
           ^                  ~~~~~~~~~~~~~~
   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.
   7 warnings generated.
>> fs/verity/read_metadata.c:38:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (arg.__reserved)
               ^~~~~~~~~~~~~~
   fs/verity/read_metadata.c:27:7: note: Calling 'fsverity_get_info'
           vi = fsverity_get_info(inode);
                ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is true
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:283:28: note: expanded from macro '__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   include/linux/fsverity.h:124:9: note: Taking false branch
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   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:320:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   include/linux/fsverity.h:124:9: note: Loop condition is false.  Exiting loop
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:171:37: note: expanded from macro 'smp_load_acquire'
           __unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p);               \
                                              ^
   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:320:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:298:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   include/linux/fsverity.h:124:9: note: Left side of '||' is false
           return smp_load_acquire(&inode->i_verity_info);
                  ^
   include/asm-generic/barrier.h:172:2: note: expanded from macro 'smp_load_acquire'
           compiletime_assert_atomic_type(*p);                             \
           ^
   include/linux/compiler_types.h:323:21: note: expanded from macro 'compiletime_assert_atomic_type'
           compiletime_assert(__native_word(t),                            \

vim +38 fs/verity/read_metadata.c

e17fe6579de023 Eric Biggers 2021-01-15  11  
e17fe6579de023 Eric Biggers 2021-01-15  12  /**
e17fe6579de023 Eric Biggers 2021-01-15  13   * fsverity_ioctl_read_metadata() - read verity metadata from a file
e17fe6579de023 Eric Biggers 2021-01-15  14   * @filp: file to read the metadata from
e17fe6579de023 Eric Biggers 2021-01-15  15   * @uarg: user pointer to fsverity_read_metadata_arg
e17fe6579de023 Eric Biggers 2021-01-15  16   *
e17fe6579de023 Eric Biggers 2021-01-15  17   * Return: length read on success, 0 on EOF, -errno on failure
e17fe6579de023 Eric Biggers 2021-01-15  18   */
e17fe6579de023 Eric Biggers 2021-01-15  19  int fsverity_ioctl_read_metadata(struct file *filp, const void __user *uarg)
e17fe6579de023 Eric Biggers 2021-01-15  20  {
e17fe6579de023 Eric Biggers 2021-01-15  21  	struct inode *inode = file_inode(filp);
e17fe6579de023 Eric Biggers 2021-01-15  22  	const struct fsverity_info *vi;
e17fe6579de023 Eric Biggers 2021-01-15  23  	struct fsverity_read_metadata_arg arg;
e17fe6579de023 Eric Biggers 2021-01-15  24  	int length;
e17fe6579de023 Eric Biggers 2021-01-15  25  	void __user *buf;
e17fe6579de023 Eric Biggers 2021-01-15  26  
e17fe6579de023 Eric Biggers 2021-01-15  27  	vi = fsverity_get_info(inode);
e17fe6579de023 Eric Biggers 2021-01-15  28  	if (!vi)
e17fe6579de023 Eric Biggers 2021-01-15  29  		return -ENODATA; /* not a verity file */
e17fe6579de023 Eric Biggers 2021-01-15  30  	/*
e17fe6579de023 Eric Biggers 2021-01-15  31  	 * Note that we don't have to explicitly check that the file is open for
e17fe6579de023 Eric Biggers 2021-01-15  32  	 * reading, since verity files can only be opened for reading.
e17fe6579de023 Eric Biggers 2021-01-15  33  	 */
e17fe6579de023 Eric Biggers 2021-01-15  34  
e17fe6579de023 Eric Biggers 2021-01-15  35  	if (copy_from_user(&arg, uarg, sizeof(arg)))
e17fe6579de023 Eric Biggers 2021-01-15  36  		return -EFAULT;
e17fe6579de023 Eric Biggers 2021-01-15  37  
e17fe6579de023 Eric Biggers 2021-01-15 @38  	if (arg.__reserved)

---
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: 29998 bytes --]

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

end of thread, other threads:[~2022-01-09  5:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09  5:19 fs/verity/read_metadata.c:38:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-08-28 21:44 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.