[alsa-devel] [asoc:for-4.20 519/523] sound/soc/stm/stm32_sai_sub.c:412:3: warning: 'strncat' specified bound 6 equals source length

kbuild test robot lkp at intel.com
Fri Oct 19 16:35:32 CEST 2018


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-4.20
head:   7ece50c9f790270e82b77589d34e54547c895a66
commit: 8307b2afd386ccce369821daa2196068c47fe8cd [519/523] ASoC: stm32: sai: set sai as mclk clock provider
config: microblaze-allyesconfig (attached as .config)
compiler: microblaze-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 8307b2afd386ccce369821daa2196068c47fe8cd
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=microblaze 

All warnings (new ones prefixed by >>):

   sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_add_mclk_provider':
>> sound/soc/stm/stm32_sai_sub.c:412:3: warning: 'strncat' specified bound 6 equals source length [-Wstringop-overflow=]
      strncat(p, "a_mclk", 6) : strncat(p, "b_mclk", 6);
      ^~~~~~~~~~~~~~~~~~~~~~~
   sound/soc/stm/stm32_sai_sub.c:412:29: warning: 'strncat' specified bound 6 equals source length [-Wstringop-overflow=]
      strncat(p, "a_mclk", 6) : strncat(p, "b_mclk", 6);
                                ^~~~~~~~~~~~~~~~~~~~~~~

vim +/strncat +412 sound/soc/stm/stm32_sai_sub.c

   383	
   384	static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai)
   385	{
   386		struct clk_hw *hw;
   387		struct stm32_sai_mclk_data *mclk;
   388		struct device *dev = &sai->pdev->dev;
   389		const char *pname = __clk_get_name(sai->sai_ck);
   390		char *mclk_name, *p, *s = (char *)pname;
   391		int ret, i = 0;
   392	
   393		mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL);
   394		if (!mclk)
   395			return -ENOMEM;
   396	
   397		mclk_name = devm_kcalloc(dev, sizeof(char),
   398					 SAI_MCLK_NAME_LEN, GFP_KERNEL);
   399		if (!mclk_name)
   400			return -ENOMEM;
   401	
   402		/*
   403		 * Forge mclk clock name from parent clock name and suffix.
   404		 * String after "_" char is stripped in parent name.
   405		 */
   406		p = mclk_name;
   407		while (*s && *s != '_' && (i < (SAI_MCLK_NAME_LEN - 6))) {
   408			*p++ = *s++;
   409			i++;
   410		}
   411		STM_SAI_IS_SUB_A(sai) ?
 > 412			strncat(p, "a_mclk", 6) : strncat(p, "b_mclk", 6);
   413	
   414		mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0);
   415		mclk->sai_data = sai;
   416		hw = &mclk->hw;
   417	
   418		dev_dbg(dev, "Register master clock %s\n", mclk_name);
   419		ret = devm_clk_hw_register(&sai->pdev->dev, hw);
   420		if (ret) {
   421			dev_err(dev, "mclk register returned %d\n", ret);
   422			return ret;
   423		}
   424		sai->sai_mclk = hw->clk;
   425	
   426		/* register mclk provider */
   427		return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
   428	}
   429	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 54690 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20181019/3c6f59e9/attachment-0001.bin>


More information about the Alsa-devel mailing list