All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457]
@ 2022-08-15  1:32 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-08-15  1:32 UTC (permalink / raw)
  To: kbuild

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

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Richard Fitzgerald <rf@opensource.cirrus.com>
CC: Mark Brown <broonie@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   568035b01cfb107af8d2e4bd2fb9aea22cf5b868
commit: 89342fa38bbaade51584f255eee5cd43621f4e10 ASoC: soc-utils: Add kunit test for snd_soc_tdm_params_to_bclk()
date:   4 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c002-20220810 (https://download.01.org/0day-ci/archive/20220815/202208150941.ST9tLAb3-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=89342fa38bbaade51584f255eee5cd43621f4e10
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 89342fa38bbaade51584f255eee5cd43621f4e10
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

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

gcc-analyzer warnings: (new ones prefixed by >>)
   sound/soc/soc-utils-test.c: In function 'test_tdm_params_to_bclk_one':
>> sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     125 |         struct snd_pcm_hw_params params;
         |                                  ^~~~~~
     'test_tdm_params_to_bclk_one': events 1-4
       |
       |  125 |         struct snd_pcm_hw_params params;
       |      |                                  ^~~~~~
       |      |                                  |
       |      |                                  (1) region created on stack here
       |      |                                  (2) following 'true' branch...
       |      |                                  (3) ...to here
       |      |                                  (4) use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' here
       |
>> sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     125 |         struct snd_pcm_hw_params params;
         |                                  ^~~~~~
     'test_tdm_params_to_bclk': event 1
       |
       |  144 | static void test_tdm_params_to_bclk(struct kunit *test)
       |      |             ^~~~~~~~~~~~~~~~~~~~~~~
       |      |             |
       |      |             (1) entry to 'test_tdm_params_to_bclk'
       |
     'test_tdm_params_to_bclk': events 2-4
       |
       |  148 |         for (i = 0; i < ARRAY_SIZE(tdm_params_to_bclk_cases); ++i) {
       |  149 |                 test_tdm_params_to_bclk_one(test,
       |      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                 |
       |      |                 (4) calling 'test_tdm_params_to_bclk_one' from 'test_tdm_params_to_bclk'
       |  150 |                                             tdm_params_to_bclk_cases[i].rate,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                                                                        |
       |      |                                                                        (3) ...to here
       |  151 |                                             tdm_params_to_bclk_cases[i].fmt,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  152 |                                             tdm_params_to_bclk_cases[i].channels,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  153 |                                             tdm_params_to_bclk_cases[i].tdm_width,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  154 |                                             tdm_params_to_bclk_cases[i].tdm_slots,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  155 |                                             tdm_params_to_bclk_cases[i].slot_multiple,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  156 |                                             tdm_params_to_bclk_cases[i].bclk);
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |
       +--> 'test_tdm_params_to_bclk_one': events 5-9
              |
              |  118 | static void test_tdm_params_to_bclk_one(struct kunit *test,
              |      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |             |
              |      |             (5) entry to 'test_tdm_params_to_bclk_one'
              |......
              |  125 |         struct snd_pcm_hw_params params;
              |      |                                  ~~~~~~
              |      |                                  |
              |      |                                  (6) region created on stack here
              |      |                                  (7) following 'true' branch...
              |      |                                  (8) ...to here
              |      |                                  (9) use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' here
              |

vim +125 sound/soc/soc-utils-test.c

89342fa38bbaad Richard Fitzgerald 2022-04-05  117  
89342fa38bbaad Richard Fitzgerald 2022-04-05  118  static void test_tdm_params_to_bclk_one(struct kunit *test,
89342fa38bbaad Richard Fitzgerald 2022-04-05  119  					unsigned int rate, snd_pcm_format_t fmt,
89342fa38bbaad Richard Fitzgerald 2022-04-05  120  					unsigned int channels,
89342fa38bbaad Richard Fitzgerald 2022-04-05  121  					unsigned int tdm_width, unsigned int tdm_slots,
89342fa38bbaad Richard Fitzgerald 2022-04-05  122  					unsigned int slot_multiple,
89342fa38bbaad Richard Fitzgerald 2022-04-05  123  					unsigned int expected_bclk)
89342fa38bbaad Richard Fitzgerald 2022-04-05  124  {
89342fa38bbaad Richard Fitzgerald 2022-04-05 @125  	struct snd_pcm_hw_params params;
89342fa38bbaad Richard Fitzgerald 2022-04-05  126  	int got_bclk;
89342fa38bbaad Richard Fitzgerald 2022-04-05  127  
89342fa38bbaad Richard Fitzgerald 2022-04-05  128  	_snd_pcm_hw_params_any(&params);
89342fa38bbaad Richard Fitzgerald 2022-04-05  129  	snd_mask_none(hw_param_mask(&params, SNDRV_PCM_HW_PARAM_FORMAT));
89342fa38bbaad Richard Fitzgerald 2022-04-05  130  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_RATE)->min = rate;
89342fa38bbaad Richard Fitzgerald 2022-04-05  131  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_RATE)->max = rate;
89342fa38bbaad Richard Fitzgerald 2022-04-05  132  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_CHANNELS)->min = channels;
89342fa38bbaad Richard Fitzgerald 2022-04-05  133  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_CHANNELS)->max = channels;
89342fa38bbaad Richard Fitzgerald 2022-04-05  134  	params_set_format(&params, fmt);
89342fa38bbaad Richard Fitzgerald 2022-04-05  135  
89342fa38bbaad Richard Fitzgerald 2022-04-05  136  	got_bclk = snd_soc_tdm_params_to_bclk(&params, tdm_width, tdm_slots, slot_multiple);
89342fa38bbaad Richard Fitzgerald 2022-04-05  137  	pr_debug("%s: r=%u sb=%u ch=%u tw=%u ts=%u sm=%u expected=%u got=%d\n",
89342fa38bbaad Richard Fitzgerald 2022-04-05  138  		 __func__,
89342fa38bbaad Richard Fitzgerald 2022-04-05  139  		 rate, params_width(&params), channels, tdm_width, tdm_slots, slot_multiple,
89342fa38bbaad Richard Fitzgerald 2022-04-05  140  		 expected_bclk, got_bclk);
89342fa38bbaad Richard Fitzgerald 2022-04-05  141  	KUNIT_ASSERT_EQ(test, expected_bclk, (unsigned int)got_bclk);
89342fa38bbaad Richard Fitzgerald 2022-04-05  142  }
89342fa38bbaad Richard Fitzgerald 2022-04-05  143  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread
* sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457]
@ 2022-08-15 12:40 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-08-15 12:40 UTC (permalink / raw)
  To: kbuild

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

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning: sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Richard Fitzgerald <rf@opensource.cirrus.com>
CC: Mark Brown <broonie@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   568035b01cfb107af8d2e4bd2fb9aea22cf5b868
commit: 89342fa38bbaade51584f255eee5cd43621f4e10 ASoC: soc-utils: Add kunit test for snd_soc_tdm_params_to_bclk()
date:   4 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 4 months ago
config: arm-randconfig-c002-20220810 (https://download.01.org/0day-ci/archive/20220815/202208152002.a2YViWmE-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=89342fa38bbaade51584f255eee5cd43621f4e10
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 89342fa38bbaade51584f255eee5cd43621f4e10
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

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

gcc-analyzer warnings: (new ones prefixed by >>)
   sound/soc/soc-utils-test.c: In function 'test_tdm_params_to_bclk_one':
>> sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     125 |         struct snd_pcm_hw_params params;
         |                                  ^~~~~~
     'test_tdm_params_to_bclk_one': events 1-4
       |
       |  125 |         struct snd_pcm_hw_params params;
       |      |                                  ^~~~~~
       |      |                                  |
       |      |                                  (1) region created on stack here
       |      |                                  (2) following 'true' branch...
       |      |                                  (3) ...to here
       |      |                                  (4) use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' here
       |
>> sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
     125 |         struct snd_pcm_hw_params params;
         |                                  ^~~~~~
     'test_tdm_params_to_bclk': event 1
       |
       |  144 | static void test_tdm_params_to_bclk(struct kunit *test)
       |      |             ^~~~~~~~~~~~~~~~~~~~~~~
       |      |             |
       |      |             (1) entry to 'test_tdm_params_to_bclk'
       |
     'test_tdm_params_to_bclk': events 2-4
       |
       |  148 |         for (i = 0; i < ARRAY_SIZE(tdm_params_to_bclk_cases); ++i) {
       |  149 |                 test_tdm_params_to_bclk_one(test,
       |      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                 |
       |      |                 (4) calling 'test_tdm_params_to_bclk_one' from 'test_tdm_params_to_bclk'
       |  150 |                                             tdm_params_to_bclk_cases[i].rate,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |                                                                        |
       |      |                                                                        (3) ...to here
       |  151 |                                             tdm_params_to_bclk_cases[i].fmt,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  152 |                                             tdm_params_to_bclk_cases[i].channels,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  153 |                                             tdm_params_to_bclk_cases[i].tdm_width,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  154 |                                             tdm_params_to_bclk_cases[i].tdm_slots,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  155 |                                             tdm_params_to_bclk_cases[i].slot_multiple,
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |  156 |                                             tdm_params_to_bclk_cases[i].bclk);
       |      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |
       +--> 'test_tdm_params_to_bclk_one': events 5-9
              |
              |  118 | static void test_tdm_params_to_bclk_one(struct kunit *test,
              |      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |             |
              |      |             (5) entry to 'test_tdm_params_to_bclk_one'
              |......
              |  125 |         struct snd_pcm_hw_params params;
              |      |                                  ~~~~~~
              |      |                                  |
              |      |                                  (6) region created on stack here
              |      |                                  (7) following 'true' branch...
              |      |                                  (8) ...to here
              |      |                                  (9) use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' here
              |

vim +125 sound/soc/soc-utils-test.c

89342fa38bbaad Richard Fitzgerald 2022-04-05  117  
89342fa38bbaad Richard Fitzgerald 2022-04-05  118  static void test_tdm_params_to_bclk_one(struct kunit *test,
89342fa38bbaad Richard Fitzgerald 2022-04-05  119  					unsigned int rate, snd_pcm_format_t fmt,
89342fa38bbaad Richard Fitzgerald 2022-04-05  120  					unsigned int channels,
89342fa38bbaad Richard Fitzgerald 2022-04-05  121  					unsigned int tdm_width, unsigned int tdm_slots,
89342fa38bbaad Richard Fitzgerald 2022-04-05  122  					unsigned int slot_multiple,
89342fa38bbaad Richard Fitzgerald 2022-04-05  123  					unsigned int expected_bclk)
89342fa38bbaad Richard Fitzgerald 2022-04-05  124  {
89342fa38bbaad Richard Fitzgerald 2022-04-05 @125  	struct snd_pcm_hw_params params;
89342fa38bbaad Richard Fitzgerald 2022-04-05  126  	int got_bclk;
89342fa38bbaad Richard Fitzgerald 2022-04-05  127  
89342fa38bbaad Richard Fitzgerald 2022-04-05  128  	_snd_pcm_hw_params_any(&params);
89342fa38bbaad Richard Fitzgerald 2022-04-05  129  	snd_mask_none(hw_param_mask(&params, SNDRV_PCM_HW_PARAM_FORMAT));
89342fa38bbaad Richard Fitzgerald 2022-04-05  130  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_RATE)->min = rate;
89342fa38bbaad Richard Fitzgerald 2022-04-05  131  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_RATE)->max = rate;
89342fa38bbaad Richard Fitzgerald 2022-04-05  132  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_CHANNELS)->min = channels;
89342fa38bbaad Richard Fitzgerald 2022-04-05  133  	hw_param_interval(&params, SNDRV_PCM_HW_PARAM_CHANNELS)->max = channels;
89342fa38bbaad Richard Fitzgerald 2022-04-05  134  	params_set_format(&params, fmt);
89342fa38bbaad Richard Fitzgerald 2022-04-05  135  
89342fa38bbaad Richard Fitzgerald 2022-04-05  136  	got_bclk = snd_soc_tdm_params_to_bclk(&params, tdm_width, tdm_slots, slot_multiple);
89342fa38bbaad Richard Fitzgerald 2022-04-05  137  	pr_debug("%s: r=%u sb=%u ch=%u tw=%u ts=%u sm=%u expected=%u got=%d\n",
89342fa38bbaad Richard Fitzgerald 2022-04-05  138  		 __func__,
89342fa38bbaad Richard Fitzgerald 2022-04-05  139  		 rate, params_width(&params), channels, tdm_width, tdm_slots, slot_multiple,
89342fa38bbaad Richard Fitzgerald 2022-04-05  140  		 expected_bclk, got_bclk);
89342fa38bbaad Richard Fitzgerald 2022-04-05  141  	KUNIT_ASSERT_EQ(test, expected_bclk, (unsigned int)got_bclk);
89342fa38bbaad Richard Fitzgerald 2022-04-05  142  }
89342fa38bbaad Richard Fitzgerald 2022-04-05  143  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-08-15 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15  1:32 sound/soc/soc-utils-test.c:125:34: warning: use of uninitialized value '((int *)_13 = PHI <&MEM <struct snd_pcm_hw_params> [(void *)&params + 4B](2), _48(3)>)[2]' [CWE-457] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-08-15 12:40 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.