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/nau8825.c:239 avs_create_dapm_routes() warn: potentially one past the end of array 'dr[idx]'
Date: Tue, 2 May 2023 15:09:50 +0800	[thread overview]
Message-ID: <202305021525.NMqOVcXo-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: 32ee40b5590081a6b38a55e4ab16b47085f93afe ASoC: Intel: avs: Add nau8825 machine board
date:   11 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 11 months ago
config: x86_64-randconfig-m001-20230501 (https://download.01.org/0day-ci/archive/20230502/202305021525.NMqOVcXo-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/202305021525.NMqOVcXo-lkp@intel.com/

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

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

vim +239 sound/soc/intel/avs/boards/nau8825.c

32ee40b5590081 Cezary Rojewski 2022-05-11  217  
32ee40b5590081 Cezary Rojewski 2022-05-11  218  static int avs_create_dapm_routes(struct device *dev, int ssp_port,
32ee40b5590081 Cezary Rojewski 2022-05-11  219  				  struct snd_soc_dapm_route **routes, int *num_routes)
32ee40b5590081 Cezary Rojewski 2022-05-11  220  {
32ee40b5590081 Cezary Rojewski 2022-05-11  221  	struct snd_soc_dapm_route *dr;
32ee40b5590081 Cezary Rojewski 2022-05-11  222  	const int num_base = ARRAY_SIZE(card_base_routes);
32ee40b5590081 Cezary Rojewski 2022-05-11  223  	const int num_dr = num_base + 2;
32ee40b5590081 Cezary Rojewski 2022-05-11  224  	int idx;
32ee40b5590081 Cezary Rojewski 2022-05-11  225  
32ee40b5590081 Cezary Rojewski 2022-05-11  226  	dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL);
32ee40b5590081 Cezary Rojewski 2022-05-11  227  	if (!dr)
32ee40b5590081 Cezary Rojewski 2022-05-11  228  		return -ENOMEM;
32ee40b5590081 Cezary Rojewski 2022-05-11  229  
32ee40b5590081 Cezary Rojewski 2022-05-11  230  	memcpy(dr, card_base_routes, num_base * sizeof(*dr));
32ee40b5590081 Cezary Rojewski 2022-05-11  231  
32ee40b5590081 Cezary Rojewski 2022-05-11  232  	idx = num_base;
32ee40b5590081 Cezary Rojewski 2022-05-11  233  	dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Playback");
32ee40b5590081 Cezary Rojewski 2022-05-11  234  	dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port);
32ee40b5590081 Cezary Rojewski 2022-05-11  235  	if (!dr[idx].sink || !dr[idx].source)
32ee40b5590081 Cezary Rojewski 2022-05-11  236  		return -ENOMEM;
32ee40b5590081 Cezary Rojewski 2022-05-11  237  
32ee40b5590081 Cezary Rojewski 2022-05-11  238  	idx++;
32ee40b5590081 Cezary Rojewski 2022-05-11 @239  	dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port);
32ee40b5590081 Cezary Rojewski 2022-05-11  240  	dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "Capture");
32ee40b5590081 Cezary Rojewski 2022-05-11  241  	if (!dr[idx].sink || !dr[idx].source)
32ee40b5590081 Cezary Rojewski 2022-05-11  242  		return -ENOMEM;
32ee40b5590081 Cezary Rojewski 2022-05-11  243  
32ee40b5590081 Cezary Rojewski 2022-05-11  244  	*routes = dr;
32ee40b5590081 Cezary Rojewski 2022-05-11  245  	*num_routes = num_dr;
32ee40b5590081 Cezary Rojewski 2022-05-11  246  
32ee40b5590081 Cezary Rojewski 2022-05-11  247  	return 0;
32ee40b5590081 Cezary Rojewski 2022-05-11  248  }
32ee40b5590081 Cezary Rojewski 2022-05-11  249  

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

             reply	other threads:[~2023-05-02  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02  7:09 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-25 18:17 sound/soc/intel/avs/boards/nau8825.c:239 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=202305021525.NMqOVcXo-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.