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/qcom/qdsp6/topology.c:336 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
Date: Sun, 20 Mar 2022 03:54:08 +0800	[thread overview]
Message-ID: <202203200312.FzthxAv6-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10711 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
CC: Mark Brown <broonie@kernel.org>
CC: "Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   34e047aa16c0123bbae8e2f6df33e5ecc1f56601
commit: 36ad9bf1d93d66b901342eab9f8ed6c1537655a6 ASoC: qdsp6: audioreach: add topology support
date:   5 months ago
:::::: branch date: 24 hours ago
:::::: commit date: 5 months ago
config: openrisc-randconfig-m031-20220319 (https://download.01.org/0day-ci/archive/20220320/202203200312.FzthxAv6-lkp(a)intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
sound/soc/qcom/qdsp6/topology.c:336 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:355 audioreach_parse_sg_tokens() error: uninitialized symbol 'sg'.
sound/soc/qcom/qdsp6/topology.c:382 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:402 audioreach_parse_cont_tokens() error: uninitialized symbol 'cont'.

Old smatch warnings:
sound/soc/qcom/qdsp6/topology.c:339 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:342 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:357 audioreach_parse_sg_tokens() error: uninitialized symbol 'sg'.
sound/soc/qcom/qdsp6/topology.c:385 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:388 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:391 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.

vim +/sg +336 sound/soc/qcom/qdsp6/topology.c

36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  302  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  303  static struct audioreach_sub_graph *audioreach_parse_sg_tokens(struct q6apm *apm,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  304  						       struct snd_soc_tplg_private *private)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  305  {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  306  	struct snd_soc_tplg_vendor_value_elem *sg_elem;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  307  	struct snd_soc_tplg_vendor_array *sg_array;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  308  	struct audioreach_graph_info *info = NULL;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  309  	int graph_id, sub_graph_id, tkn_count = 0;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  310  	struct audioreach_sub_graph *sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  311  	bool found;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  312  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  313  	sg_array = audioreach_get_sg_array(private);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  314  	sg_elem = sg_array->value;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  315  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  316  	while (tkn_count <= (le32_to_cpu(sg_array->num_elems) - 1)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  317  		switch (le32_to_cpu(sg_elem->token)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  318  		case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  319  			sub_graph_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  320  			sg = audioreach_tplg_alloc_sub_graph(apm, sub_graph_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  321  			if (IS_ERR(sg)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  322  				return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  323  			} else if (found) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  324  				/* Already parsed data for this sub-graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  325  				return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  326  			}
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  327  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  328  		case AR_TKN_DAI_INDEX:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  329  			/* Sub graph is associated with predefined graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  330  			graph_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  331  			info = audioreach_tplg_alloc_graph_info(apm, graph_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  332  			if (IS_ERR(info))
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  333  				return ERR_CAST(info);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  334  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  335  		case AR_TKN_U32_SUB_GRAPH_PERF_MODE:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @336  			sg->perf_mode = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  337  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  338  		case AR_TKN_U32_SUB_GRAPH_DIRECTION:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  339  			sg->direction = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  340  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  341  		case AR_TKN_U32_SUB_GRAPH_SCENARIO_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  342  			sg->scenario_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  343  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  344  		default:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  345  			dev_err(apm->dev, "Not a valid token %d for graph\n", sg_elem->token);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  346  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  347  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  348  		}
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  349  		tkn_count++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  350  		sg_elem++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  351  	}
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  352  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  353  	/* Sub graph is associated with predefined graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  354  	if (info)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @355  		audioreach_tplg_add_sub_graph(sg, info);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  356  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  357  	return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  358  }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  359  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  360  static struct audioreach_container *audioreach_parse_cont_tokens(struct q6apm *apm,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  361  							 struct audioreach_sub_graph *sg,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  362  							 struct snd_soc_tplg_private *private)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  363  {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  364  	struct snd_soc_tplg_vendor_value_elem *cont_elem;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  365  	struct snd_soc_tplg_vendor_array *cont_array;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  366  	struct audioreach_container *cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  367  	int container_id, tkn_count = 0;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  368  	bool found = false;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  369  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  370  	cont_array = audioreach_get_cont_array(private);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  371  	cont_elem = cont_array->value;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  372  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  373  	while (tkn_count <= (le32_to_cpu(cont_array->num_elems) - 1)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  374  		switch (le32_to_cpu(cont_elem->token)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  375  		case AR_TKN_U32_CONTAINER_INSTANCE_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  376  			container_id = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  377  			cont = audioreach_tplg_alloc_container(apm, sg, container_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  378  			if (IS_ERR(cont) || found)/* Error or Already parsed container data */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  379  				return cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  380  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  381  		case AR_TKN_U32_CONTAINER_CAPABILITY_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @382  			cont->capability_id = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  383  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  384  		case AR_TKN_U32_CONTAINER_STACK_SIZE:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  385  			cont->stack_size = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  386  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  387  		case AR_TKN_U32_CONTAINER_GRAPH_POS:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  388  			cont->graph_pos = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  389  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  390  		case AR_TKN_U32_CONTAINER_PROC_DOMAIN:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  391  			cont->proc_domain = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  392  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  393  		default:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  394  			dev_err(apm->dev, "Not a valid token %d for graph\n", cont_elem->token);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  395  			break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  396  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  397  		}
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  398  		tkn_count++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  399  		cont_elem++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  400  	}
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  401  
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @402  	return cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  403  }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26  404  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

             reply	other threads:[~2022-03-19 19:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 19:54 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-26  0:41 sound/soc/qcom/qdsp6/topology.c:336 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg' kernel test robot
2022-04-19  3:26 kernel test robot
2022-01-20  8:19 Dan Carpenter
2022-01-20  7:52 ` kernel test robot
2022-01-20  8:19 ` Dan Carpenter
2021-12-10 15:09 kernel test robot
2021-12-10 15:01 Dan Carpenter
2021-12-10 14:48 ` kernel test robot
2021-12-10 15:01 ` Dan Carpenter
2021-11-25 15:25 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=202203200312.FzthxAv6-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.