Re: [PATCH 09/10] ASoC: Intel: avs: Refactor and fix init_config access

Mark Brown <[email protected]>
Newsgroups gmane.linux.sound
Message-ID <[email protected]>
On Thu, Aug 27, 2026 at 03:15:09PM +0200, Cezary Rojewski wrote:
> Existing code accesses enties found in ->init_configs array through
> indexes that are part of ->config_ids array.  Those two are limited by:
> ->num_init_configs and ->num_config_ids respectively.  Using ID larger
> or equal to ->num_init_configs leads to out-of-bounds access:

> -	acomp = to_avs_soc_component(mod->template->owner->owner->owner->owner->comp);
> +	acomp = to_avs_soc_component(template->owner->owner->owner->owner->comp);
>  
> -	u32 num_ids = mod->template->num_config_ids;
> -	u32 *ids = mod->template->config_ids;
> -
> -	for (int i = 0; i < num_ids; i++) {
> -		struct avs_tplg_init_config *config = &acomp->tplg->init_configs[ids[i]];
> +	for (int i = 0; i < template->num_init_configs; i++) {
> +		struct avs_tplg_init_config *config = template->init_configs[i];

I don't see any users of acomp left after this refactoring?
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmqQTFoACgkQJNaLcl1U
h9Av5wf9EPnYhfAl5jSE3TG7U7aY8FAhXrvFi0FBnJi8XXVqB4sDGFg1zWG96FO8
HBI+5yKnVM5OLZTPf8vOhVuHO890e77DKRVBZurkMGhBdq8uBI6i8HMWQ2kUiifo
Ys5GTa1VZGGqrUsNxurYFhJXtvpueMcwH2UJqQj2cmCrBvaofpYThkQvce4EhTNJ
563qNj4wnNCtbVXfODMMl5rykJb91iV8afAm1Q6VCKivcRiqZ5H8P479thHVNwlw
K6pclXFQf1iRZMhRdhwAkO07cpCXk3iaGO4eyLXhtN4LdflekMDNlhU/S/B6QcuF
WTaLPQPp19W4CrSAow1HEKwu1a9iQw==
=xSgp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.