All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/core/oss/pcm_oss.c:2377:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-12-17  8:51 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-12-17  8:51 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Mark Rutland <mark.rutland@arm.com>
CC: Peter Zijlstra <peterz@infradead.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6441998e2e37131b0a4c310af9156d79d3351c16
commit: fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3 locking/atomic: arm: move to ARCH_ATOMIC
date:   7 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 7 months ago
config: arm-randconfig-c002-20211215 (https://download.01.org/0day-ci/archive/20211217/202112171657.WM2Eyr6v-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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=fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3
        # save the config file 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/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:733:6: note: 'min_period_size' is 0
           if (min_period_size) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:733:2: note: '?' condition is false
           if (min_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:733:2: note: Taking false branch
           if (min_period_size) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:742:2: note: Assuming 'max_period_size' is not equal to 0
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:742:2: note: '?' condition is false
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:742:6: note: 'max_period_size' is not equal to 0
           if (max_period_size) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:742:2: note: '?' condition is true
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:742:2: note: Taking true branch
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:744:21: note: '?' condition is false
                   max_period_size = rounddown_pow_of_two(max_period_size);
                                     ^
   include/linux/log2.h:193:2: note: expanded from macro 'rounddown_pow_of_two'
           __builtin_constant_p(n) ? (             \
           ^
   sound/core/oss/pcm_oss.c:744:21: note: Calling '__rounddown_pow_of_two'
                   max_period_size = rounddown_pow_of_two(max_period_size);
                                     ^
   include/linux/log2.h:195:2: note: expanded from macro 'rounddown_pow_of_two'
           __rounddown_pow_of_two(n)               \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/log2.h:67:13: 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'
           return 1UL << (fls_long(n) - 1);
                      ^  ~~~~~~~~~~~~~~~~~
>> sound/core/oss/pcm_oss.c:2377:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
                   ^
   sound/core/oss/pcm_oss.c:2396:2: note: Assuming 'rpcm_oss_file' is null
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2396:6: note: 'rpcm_oss_file' is null
           if (rpcm_oss_file)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2396:2: note: Taking false branch
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2399:17: note: Calling 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:9: note: Storing uninitialized value
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2399:17: note: Returning from 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2400:6: note: Assuming 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2400:6: note: 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
--
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2421:3: note: '?' condition is false
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2421:7: note: 'err' is < 0
                   if (err < 0) {
                       ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2421:3: note: '?' condition is true
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2421:3: note: Taking true branch
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2422:4: note: Calling 'snd_pcm_oss_release_file'
                           snd_pcm_oss_release_file(pcm_oss_file);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2374:7: note: 'pcm_oss_file' is non-null
           if (!pcm_oss_file)
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2374:2: note: '?' condition is false
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2374:7: note: 'pcm_oss_file' is non-null
           if (!pcm_oss_file)
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2374:2: note: '?' condition is false
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2374:2: note: Taking false branch
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2376:7: note: The value 0 is assigned to 'cidx'
           for (cidx = 0; cidx < 2; ++cidx) {
                ^~~~~~~~
   sound/core/oss/pcm_oss.c:2376:2: note: Loop condition is true.  Entering loop body
           for (cidx = 0; cidx < 2; ++cidx) {
           ^
   sound/core/oss/pcm_oss.c:2377:3: note: Assigned value is garbage or undefined
                   struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
                   ^                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/core/oss/pcm_oss.c:2430:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (!pcm_oss_file->streams[0] && !pcm_oss_file->streams[1]) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: Assuming 'rpcm_oss_file' is null
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2396:6: note: 'rpcm_oss_file' is null
           if (rpcm_oss_file)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2396:2: note: Taking false branch
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2399:17: note: Calling 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:9: note: Storing uninitialized value
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2399:17: note: Returning from 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2400:6: note: Assuming 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2400:6: note: 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )

vim +2377 sound/core/oss/pcm_oss.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  2370  
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2371  static int snd_pcm_oss_release_file(struct snd_pcm_oss_file *pcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2372  {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2373  	int cidx;
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2374  	if (!pcm_oss_file)
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2375  		return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2376  	for (cidx = 0; cidx < 2; ++cidx) {
6ac77bc180fbd9 Takashi Iwai   2005-11-17 @2377  		struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
3bf75f9b90c981 Takashi Iwai   2006-03-27  2378  		if (substream)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2379  			snd_pcm_release_substream(substream);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2380  	}
^1da177e4c3f41 Linus Torvalds 2005-04-16  2381  	kfree(pcm_oss_file);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2382  	return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2383  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  2384  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2385  static int snd_pcm_oss_open_file(struct file *file,
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2386  				 struct snd_pcm *pcm,
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2387  				 struct snd_pcm_oss_file **rpcm_oss_file,
^1da177e4c3f41 Linus Torvalds 2005-04-16  2388  				 int minor,
060d77b9c04acd Takashi Iwai   2006-03-27  2389  				 struct snd_pcm_oss_setup *setup)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2390  {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2391  	int idx, err;
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2392  	struct snd_pcm_oss_file *pcm_oss_file;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2393  	struct snd_pcm_substream *substream;
aeb5d727062a02 Al Viro        2008-09-02  2394  	fmode_t f_mode = file->f_mode;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2395  
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2396  	if (rpcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2397  		*rpcm_oss_file = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2398  
ca2c0966562cfb Takashi Iwai   2005-09-09  2399  	pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2400  	if (pcm_oss_file == NULL)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2401  		return -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2402  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2403  	if ((f_mode & (FMODE_WRITE|FMODE_READ)) == (FMODE_WRITE|FMODE_READ) &&
^1da177e4c3f41 Linus Torvalds 2005-04-16  2404  	    (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX))
^1da177e4c3f41 Linus Torvalds 2005-04-16  2405  		f_mode = FMODE_WRITE;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2406  
0df63e44c3e315 Takashi Iwai   2006-04-28  2407  	file->f_flags &= ~O_APPEND;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2408  	for (idx = 0; idx < 2; idx++) {
060d77b9c04acd Takashi Iwai   2006-03-27  2409  		if (setup[idx].disable)
3bf75f9b90c981 Takashi Iwai   2006-03-27  2410  			continue;
6cb53e7ed77d42 Takashi Iwai   2006-08-02  2411  		if (! pcm->streams[idx].substream_count)
6cb53e7ed77d42 Takashi Iwai   2006-08-02  2412  			continue; /* no matching substream */
3bf75f9b90c981 Takashi Iwai   2006-03-27  2413  		if (idx == SNDRV_PCM_STREAM_PLAYBACK) {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2414  			if (! (f_mode & FMODE_WRITE))
3bf75f9b90c981 Takashi Iwai   2006-03-27  2415  				continue;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2416  		} else {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2417  			if (! (f_mode & FMODE_READ))
3bf75f9b90c981 Takashi Iwai   2006-03-27  2418  				continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2419  		}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2420  		err = snd_pcm_open_substream(pcm, idx, file, &substream);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2421  		if (err < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2422  			snd_pcm_oss_release_file(pcm_oss_file);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2423  			return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2424  		}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2425  
3bf75f9b90c981 Takashi Iwai   2006-03-27  2426  		pcm_oss_file->streams[idx] = substream;
060d77b9c04acd Takashi Iwai   2006-03-27  2427  		snd_pcm_oss_init_substream(substream, &setup[idx], minor);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2428  	}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2429  	
bbdc1b7dbe4157 OGAWA Hirofumi 2006-04-06 @2430  	if (!pcm_oss_file->streams[0] && !pcm_oss_file->streams[1]) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2431  		snd_pcm_oss_release_file(pcm_oss_file);
3bf75f9b90c981 Takashi Iwai   2006-03-27  2432  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2433  	}
^1da177e4c3f41 Linus Torvalds 2005-04-16  2434  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2435  	file->private_data = pcm_oss_file;
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2436  	if (rpcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2437  		*rpcm_oss_file = pcm_oss_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2438  	return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2439  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  2440  

:::::: The code at line 2377 was first introduced by commit
:::::: 6ac77bc180fbd985988015020c2e2347e802959d [ALSA] Remove xxx_t typedefs: PCM OSS-emulation

:::::: TO: Takashi Iwai <tiwai@suse.de>
:::::: CC: Jaroslav Kysela <perex@suse.cz>

---
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

* sound/core/oss/pcm_oss.c:2377:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-12-16 23:08 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-12-16 23:08 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Mark Rutland <mark.rutland@arm.com>
CC: Peter Zijlstra <peterz@infradead.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fa36bbe6d43f3bbce1f10a187e153587c7584d83
commit: fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3 locking/atomic: arm: move to ARCH_ATOMIC
date:   7 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 7 months ago
config: arm-randconfig-c002-20211215 (https://download.01.org/0day-ci/archive/20211217/202112170722.QJcRozeU-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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=fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout fc63a6e08a8c97a3dc3a6f2e1946b949b9a6c2d3
        # save the config file 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/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:733:6: note: 'min_period_size' is 0
           if (min_period_size) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:733:2: note: '?' condition is false
           if (min_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:733:2: note: Taking false branch
           if (min_period_size) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:742:2: note: Assuming 'max_period_size' is not equal to 0
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:742:2: note: '?' condition is false
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:742:6: note: 'max_period_size' is not equal to 0
           if (max_period_size) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:742:2: note: '?' condition is true
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:742:2: note: Taking true branch
           if (max_period_size) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:744:21: note: '?' condition is false
                   max_period_size = rounddown_pow_of_two(max_period_size);
                                     ^
   include/linux/log2.h:193:2: note: expanded from macro 'rounddown_pow_of_two'
           __builtin_constant_p(n) ? (             \
           ^
   sound/core/oss/pcm_oss.c:744:21: note: Calling '__rounddown_pow_of_two'
                   max_period_size = rounddown_pow_of_two(max_period_size);
                                     ^
   include/linux/log2.h:195:2: note: expanded from macro 'rounddown_pow_of_two'
           __rounddown_pow_of_two(n)               \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/log2.h:67:13: 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'
           return 1UL << (fls_long(n) - 1);
                      ^  ~~~~~~~~~~~~~~~~~
>> sound/core/oss/pcm_oss.c:2377:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
                   struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
                   ^
   sound/core/oss/pcm_oss.c:2396:2: note: Assuming 'rpcm_oss_file' is null
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2396:6: note: 'rpcm_oss_file' is null
           if (rpcm_oss_file)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2396:2: note: Taking false branch
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2399:17: note: Calling 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:9: note: Storing uninitialized value
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2399:17: note: Returning from 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2400:6: note: Assuming 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2400:6: note: 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
--
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2421:3: note: '?' condition is false
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2421:7: note: 'err' is < 0
                   if (err < 0) {
                       ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2421:3: note: '?' condition is true
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2421:3: note: Taking true branch
                   if (err < 0) {
                   ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2422:4: note: Calling 'snd_pcm_oss_release_file'
                           snd_pcm_oss_release_file(pcm_oss_file);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2374:7: note: 'pcm_oss_file' is non-null
           if (!pcm_oss_file)
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2374:2: note: '?' condition is false
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2374:7: note: 'pcm_oss_file' is non-null
           if (!pcm_oss_file)
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2374:2: note: '?' condition is false
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2374:2: note: Taking false branch
           if (!pcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2376:7: note: The value 0 is assigned to 'cidx'
           for (cidx = 0; cidx < 2; ++cidx) {
                ^~~~~~~~
   sound/core/oss/pcm_oss.c:2376:2: note: Loop condition is true.  Entering loop body
           for (cidx = 0; cidx < 2; ++cidx) {
           ^
   sound/core/oss/pcm_oss.c:2377:3: note: Assigned value is garbage or undefined
                   struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
                   ^                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/core/oss/pcm_oss.c:2430:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (!pcm_oss_file->streams[0] && !pcm_oss_file->streams[1]) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: Assuming 'rpcm_oss_file' is null
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2396:6: note: 'rpcm_oss_file' is null
           if (rpcm_oss_file)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2396:2: note: '?' condition is false
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   sound/core/oss/pcm_oss.c:2396:2: note: Taking false branch
           if (rpcm_oss_file)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   sound/core/oss/pcm_oss.c:2399:17: note: Calling 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:686:9: note: Storing uninitialized value
           return kmalloc(size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2399:17: note: Returning from 'kzalloc'
           pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/core/oss/pcm_oss.c:2400:6: note: Assuming 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   sound/core/oss/pcm_oss.c:2400:6: note: 'pcm_oss_file' is not equal to null
           if (pcm_oss_file == NULL)
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   sound/core/oss/pcm_oss.c:2400:2: note: '?' condition is false
           if (pcm_oss_file == NULL)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )

vim +2377 sound/core/oss/pcm_oss.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  2370  
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2371  static int snd_pcm_oss_release_file(struct snd_pcm_oss_file *pcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2372  {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2373  	int cidx;
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2374  	if (!pcm_oss_file)
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2375  		return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2376  	for (cidx = 0; cidx < 2; ++cidx) {
6ac77bc180fbd9 Takashi Iwai   2005-11-17 @2377  		struct snd_pcm_substream *substream = pcm_oss_file->streams[cidx];
3bf75f9b90c981 Takashi Iwai   2006-03-27  2378  		if (substream)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2379  			snd_pcm_release_substream(substream);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2380  	}
^1da177e4c3f41 Linus Torvalds 2005-04-16  2381  	kfree(pcm_oss_file);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2382  	return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2383  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  2384  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2385  static int snd_pcm_oss_open_file(struct file *file,
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2386  				 struct snd_pcm *pcm,
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2387  				 struct snd_pcm_oss_file **rpcm_oss_file,
^1da177e4c3f41 Linus Torvalds 2005-04-16  2388  				 int minor,
060d77b9c04acd Takashi Iwai   2006-03-27  2389  				 struct snd_pcm_oss_setup *setup)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2390  {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2391  	int idx, err;
6ac77bc180fbd9 Takashi Iwai   2005-11-17  2392  	struct snd_pcm_oss_file *pcm_oss_file;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2393  	struct snd_pcm_substream *substream;
aeb5d727062a02 Al Viro        2008-09-02  2394  	fmode_t f_mode = file->f_mode;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2395  
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2396  	if (rpcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2397  		*rpcm_oss_file = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2398  
ca2c0966562cfb Takashi Iwai   2005-09-09  2399  	pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2400  	if (pcm_oss_file == NULL)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2401  		return -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2402  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2403  	if ((f_mode & (FMODE_WRITE|FMODE_READ)) == (FMODE_WRITE|FMODE_READ) &&
^1da177e4c3f41 Linus Torvalds 2005-04-16  2404  	    (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX))
^1da177e4c3f41 Linus Torvalds 2005-04-16  2405  		f_mode = FMODE_WRITE;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2406  
0df63e44c3e315 Takashi Iwai   2006-04-28  2407  	file->f_flags &= ~O_APPEND;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2408  	for (idx = 0; idx < 2; idx++) {
060d77b9c04acd Takashi Iwai   2006-03-27  2409  		if (setup[idx].disable)
3bf75f9b90c981 Takashi Iwai   2006-03-27  2410  			continue;
6cb53e7ed77d42 Takashi Iwai   2006-08-02  2411  		if (! pcm->streams[idx].substream_count)
6cb53e7ed77d42 Takashi Iwai   2006-08-02  2412  			continue; /* no matching substream */
3bf75f9b90c981 Takashi Iwai   2006-03-27  2413  		if (idx == SNDRV_PCM_STREAM_PLAYBACK) {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2414  			if (! (f_mode & FMODE_WRITE))
3bf75f9b90c981 Takashi Iwai   2006-03-27  2415  				continue;
3bf75f9b90c981 Takashi Iwai   2006-03-27  2416  		} else {
3bf75f9b90c981 Takashi Iwai   2006-03-27  2417  			if (! (f_mode & FMODE_READ))
3bf75f9b90c981 Takashi Iwai   2006-03-27  2418  				continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2419  		}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2420  		err = snd_pcm_open_substream(pcm, idx, file, &substream);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2421  		if (err < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2422  			snd_pcm_oss_release_file(pcm_oss_file);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2423  			return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2424  		}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2425  
3bf75f9b90c981 Takashi Iwai   2006-03-27  2426  		pcm_oss_file->streams[idx] = substream;
060d77b9c04acd Takashi Iwai   2006-03-27  2427  		snd_pcm_oss_init_substream(substream, &setup[idx], minor);
^1da177e4c3f41 Linus Torvalds 2005-04-16  2428  	}
3bf75f9b90c981 Takashi Iwai   2006-03-27  2429  	
bbdc1b7dbe4157 OGAWA Hirofumi 2006-04-06 @2430  	if (!pcm_oss_file->streams[0] && !pcm_oss_file->streams[1]) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  2431  		snd_pcm_oss_release_file(pcm_oss_file);
3bf75f9b90c981 Takashi Iwai   2006-03-27  2432  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2433  	}
^1da177e4c3f41 Linus Torvalds 2005-04-16  2434  
^1da177e4c3f41 Linus Torvalds 2005-04-16  2435  	file->private_data = pcm_oss_file;
7eaa943c8ed8e9 Takashi Iwai   2008-08-08  2436  	if (rpcm_oss_file)
^1da177e4c3f41 Linus Torvalds 2005-04-16  2437  		*rpcm_oss_file = pcm_oss_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2438  	return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  2439  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  2440  

:::::: The code at line 2377 was first introduced by commit
:::::: 6ac77bc180fbd985988015020c2e2347e802959d [ALSA] Remove xxx_t typedefs: PCM OSS-emulation

:::::: TO: Takashi Iwai <tiwai@suse.de>
:::::: CC: Jaroslav Kysela <perex@suse.cz>

---
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

end of thread, other threads:[~2021-12-17  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17  8:51 sound/core/oss/pcm_oss.c:2377:3: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-12-16 23:08 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.