All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: sound/soc/intel/avs/boards/rt286.c:177 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'
Date: Tue, 2 May 2023 10:42:13 +0800	[thread overview]
Message-ID: <202305021025.d8tvhQIp-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Cezary Rojewski <cezary.rojewski@intel.com>
CC: Mark Brown <broonie@kernel.org>
CC: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   865fdb08197e657c59e74a35fa32362b12397f58
commit: 1d395ee2e19b33a1008acfc7af186f2851b63d01 ASoC: Intel: avs: Add rt286 machine board
date:   11 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 11 months ago
config: x86_64-randconfig-m001-20230501 (https://download.01.org/0day-ci/archive/20230502/202305021025.d8tvhQIp-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202305021025.d8tvhQIp-lkp@intel.com/

New smatch warnings:
sound/soc/intel/avs/boards/rt286.c:177 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'

Old smatch warnings:
sound/soc/intel/avs/boards/rt286.c:178 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'
sound/soc/intel/avs/boards/rt286.c:179 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'
sound/soc/intel/avs/boards/rt286.c:179 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'

vim +177 sound/soc/intel/avs/boards/rt286.c

1d395ee2e19b33 Cezary Rojewski 2022-05-11  155  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  156  static int avs_create_dapm_routes(struct device *dev, int ssp_port,
1d395ee2e19b33 Cezary Rojewski 2022-05-11  157  				  struct snd_soc_dapm_route **routes, int *num_routes)
1d395ee2e19b33 Cezary Rojewski 2022-05-11  158  {
1d395ee2e19b33 Cezary Rojewski 2022-05-11  159  	struct snd_soc_dapm_route *dr;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  160  	const int num_base = ARRAY_SIZE(card_base_routes);
1d395ee2e19b33 Cezary Rojewski 2022-05-11  161  	const int num_dr = num_base + 2;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  162  	int idx;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  163  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  164  	dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL);
1d395ee2e19b33 Cezary Rojewski 2022-05-11  165  	if (!dr)
1d395ee2e19b33 Cezary Rojewski 2022-05-11  166  		return -ENOMEM;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  167  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  168  	memcpy(dr, card_base_routes, num_base * sizeof(*dr));
1d395ee2e19b33 Cezary Rojewski 2022-05-11  169  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  170  	idx = num_base;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  171  	dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Playback");
1d395ee2e19b33 Cezary Rojewski 2022-05-11  172  	dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port);
1d395ee2e19b33 Cezary Rojewski 2022-05-11  173  	if (!dr[idx].sink || !dr[idx].source)
1d395ee2e19b33 Cezary Rojewski 2022-05-11  174  		return -ENOMEM;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  175  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  176  	idx++;
1d395ee2e19b33 Cezary Rojewski 2022-05-11 @177  	dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port);
1d395ee2e19b33 Cezary Rojewski 2022-05-11  178  	dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Capture");
1d395ee2e19b33 Cezary Rojewski 2022-05-11  179  	if (!dr[idx].sink || !dr[idx].source)
1d395ee2e19b33 Cezary Rojewski 2022-05-11  180  		return -ENOMEM;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  181  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  182  	*routes = dr;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  183  	*num_routes = num_dr;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  184  
1d395ee2e19b33 Cezary Rojewski 2022-05-11  185  	return 0;
1d395ee2e19b33 Cezary Rojewski 2022-05-11  186  }
1d395ee2e19b33 Cezary Rojewski 2022-05-11  187  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

             reply	other threads:[~2023-05-02  2:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02  2:42 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-25 12:23 sound/soc/intel/avs/boards/rt286.c:177 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]' 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=202305021025.d8tvhQIp-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.