All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: 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]
Date: Mon, 15 Aug 2022 09:32:26 +0800	[thread overview]
Message-ID: <202208150941.ST9tLAb3-lkp@intel.com> (raw)

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

             reply	other threads:[~2022-08-15  1:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  1:32 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-15 12:40 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

Reply instructions:

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

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

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

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

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

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.