Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: cs_dsp: Fix new control name check

Before adding a new FW control, its name is checked against
existing controls list. But the string length in strncmp used
to compare controls names is taken from the list, so if beginnings
of the controls are matching, then the new control is not created.
For example, if CAL_R control already exists, CAL_R_SELECTED
is not created.
The fix is to compare string lengths as well.

Fixes: 6477960755fb ("ASoC: wm_adsp: Move check for control existence")
Signed-off-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230815172908.3454056-1-vkarpovi@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Vlad Karpovich and committed by
Mark Brown
7ac1102b 49a4a8d1

+2 -1
+2 -1
drivers/firmware/cirrus/cs_dsp.c
··· 978 978 ctl->alg_region.alg == alg_region->alg && 979 979 ctl->alg_region.type == alg_region->type) { 980 980 if ((!subname && !ctl->subname) || 981 - (subname && !strncmp(ctl->subname, subname, ctl->subname_len))) { 981 + (subname && (ctl->subname_len == subname_len) && 982 + !strncmp(ctl->subname, subname, ctl->subname_len))) { 982 983 if (!ctl->enabled) 983 984 ctl->enabled = 1; 984 985 return 0;