From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang...
Date: Fri, 26 Nov 2021 16:32:14 +0800 [thread overview]
Message-ID: <202111261659.1M8beKNp-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 19890 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Olivier Moysan <olivier.moysan@st.com>
CC: Mark Brown <broonie@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a4849f6000e29235a2707f22e39da6b897bb9543
commit: 8a262e614ef8675cfde924c6ddf873a95db0be6a ASoC: stm32: i2s: add master clock provider
date: 10 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 10 months ago
config: arm-randconfig-c002-20210929 (https://download.01.org/0day-ci/archive/20211126/202111261659.1M8beKNp-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8a262e614ef8675cfde924c6ddf873a95db0be6a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8a262e614ef8675cfde924c6ddf873a95db0be6a
# 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 >>)
^ ~
drivers/video/fbdev/nvidia/nv_hw.c:439:2: note: Value stored to 'clwm' is never read
clwm = 0;
^ ~
Suppressed 34 warnings (32 in non-user code, 2 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
36 warnings generated.
Suppressed 36 warnings (32 in non-user code, 4 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
32 warnings generated.
Suppressed 32 warnings (32 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/xtensa/xtfpga-i2s.c:285:11: warning: Value stored to 'channels' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
unsigned channels = params_channels(params);
^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/xtensa/xtfpga-i2s.c:285:11: note: Value stored to 'channels' during its initialization is never read
unsigned channels = params_channels(params);
^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/kirkwood/kirkwood-i2s.c:322:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
value = readl(priv->io + KIRKWOOD_RECCTL);
^
sound/soc/kirkwood/kirkwood-i2s.c:322:2: note: Value stored to 'value' is never read
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18 warnings generated.
>> sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:434:2: note: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119
strcat(p, "_mclk");
^~~~~~
sound/soc/stm/stm32_i2s.c:455:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
sound/soc/stm/stm32_i2s.c:455:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = i2s->pdev;
^~~~ ~~~~~~~~~
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
sound/soc/bcm/bcm63xx-pcm-whistler.c:281:31: warning: The left operand of '+' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
prtd->dma_addr_next = val_1 + val_2;
~~~~~ ^
sound/soc/bcm/bcm63xx-pcm-whistler.c:252:59: note: 'val_1' declared without an initial value
unsigned int availdepth, ifflevel, offlevel, int_status, val_1, val_2;
^~~~~
sound/soc/bcm/bcm63xx-pcm-whistler.c:267:6: note: Assuming the condition is true
if (int_status & I2S_RX_DESC_OFF_INTR_EN_MSK) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/bcm/bcm63xx-pcm-whistler.c:267:2: note: Taking true branch
if (int_status & I2S_RX_DESC_OFF_INTR_EN_MSK) {
^
sound/soc/bcm/bcm63xx-pcm-whistler.c:276:3: note: Loop condition is false. Execution continues on line 281
while (offlevel) {
^
sound/soc/bcm/bcm63xx-pcm-whistler.c:281:31: note: The left operand of '+' is a garbage value
prtd->dma_addr_next = val_1 + val_2;
~~~~~ ^
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
15 warnings generated.
Suppressed 15 warnings (15 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17 warnings generated.
Suppressed 17 warnings (17 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (16 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
vim +434 sound/soc/stm/stm32_i2s.c
8a262e614ef8675 Olivier Moysan 2021-02-05 406
8a262e614ef8675 Olivier Moysan 2021-02-05 407 static int stm32_i2s_add_mclk_provider(struct stm32_i2s_data *i2s)
8a262e614ef8675 Olivier Moysan 2021-02-05 408 {
8a262e614ef8675 Olivier Moysan 2021-02-05 409 struct clk_hw *hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 410 struct stm32_i2smclk_data *mclk;
8a262e614ef8675 Olivier Moysan 2021-02-05 411 struct device *dev = &i2s->pdev->dev;
8a262e614ef8675 Olivier Moysan 2021-02-05 412 const char *pname = __clk_get_name(i2s->i2sclk);
8a262e614ef8675 Olivier Moysan 2021-02-05 413 char *mclk_name, *p, *s = (char *)pname;
8a262e614ef8675 Olivier Moysan 2021-02-05 414 int ret, i = 0;
8a262e614ef8675 Olivier Moysan 2021-02-05 415
8a262e614ef8675 Olivier Moysan 2021-02-05 416 mclk = devm_kzalloc(dev, sizeof(*mclk), GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 417 if (!mclk)
8a262e614ef8675 Olivier Moysan 2021-02-05 418 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 419
8a262e614ef8675 Olivier Moysan 2021-02-05 420 mclk_name = devm_kcalloc(dev, sizeof(char),
8a262e614ef8675 Olivier Moysan 2021-02-05 421 STM32_I2S_NAME_LEN, GFP_KERNEL);
8a262e614ef8675 Olivier Moysan 2021-02-05 422 if (!mclk_name)
8a262e614ef8675 Olivier Moysan 2021-02-05 423 return -ENOMEM;
8a262e614ef8675 Olivier Moysan 2021-02-05 424
8a262e614ef8675 Olivier Moysan 2021-02-05 425 /*
8a262e614ef8675 Olivier Moysan 2021-02-05 426 * Forge mclk clock name from parent clock name and suffix.
8a262e614ef8675 Olivier Moysan 2021-02-05 427 * String after "_" char is stripped in parent name.
8a262e614ef8675 Olivier Moysan 2021-02-05 428 */
8a262e614ef8675 Olivier Moysan 2021-02-05 429 p = mclk_name;
8a262e614ef8675 Olivier Moysan 2021-02-05 430 while (*s && *s != '_' && (i < (STM32_I2S_NAME_LEN - 7))) {
8a262e614ef8675 Olivier Moysan 2021-02-05 431 *p++ = *s++;
8a262e614ef8675 Olivier Moysan 2021-02-05 432 i++;
8a262e614ef8675 Olivier Moysan 2021-02-05 433 }
8a262e614ef8675 Olivier Moysan 2021-02-05 @434 strcat(p, "_mclk");
8a262e614ef8675 Olivier Moysan 2021-02-05 435
8a262e614ef8675 Olivier Moysan 2021-02-05 436 mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0);
8a262e614ef8675 Olivier Moysan 2021-02-05 437 mclk->i2s_data = i2s;
8a262e614ef8675 Olivier Moysan 2021-02-05 438 hw = &mclk->hw;
8a262e614ef8675 Olivier Moysan 2021-02-05 439
8a262e614ef8675 Olivier Moysan 2021-02-05 440 dev_dbg(dev, "Register master clock %s\n", mclk_name);
8a262e614ef8675 Olivier Moysan 2021-02-05 441 ret = devm_clk_hw_register(&i2s->pdev->dev, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 442 if (ret) {
8a262e614ef8675 Olivier Moysan 2021-02-05 443 dev_err(dev, "mclk register fails with error %d\n", ret);
8a262e614ef8675 Olivier Moysan 2021-02-05 444 return ret;
8a262e614ef8675 Olivier Moysan 2021-02-05 445 }
8a262e614ef8675 Olivier Moysan 2021-02-05 446 i2s->i2smclk = hw->clk;
8a262e614ef8675 Olivier Moysan 2021-02-05 447
8a262e614ef8675 Olivier Moysan 2021-02-05 448 /* register mclk provider */
8a262e614ef8675 Olivier Moysan 2021-02-05 449 return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
8a262e614ef8675 Olivier Moysan 2021-02-05 450 }
8a262e614ef8675 Olivier Moysan 2021-02-05 451
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2021-11-26 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 8:32 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-01-28 16:56 sound/soc/stm/stm32_i2s.c:434:2: warning: Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119 [clang kernel test robot
2022-01-25 13:10 kernel test robot
2021-09-30 21:40 kernel test robot
2021-09-30 4:40 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=202111261659.1M8beKNp-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.