[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230804165212.236822-1-vkarpovi@opensource.cirrus.com>
Date: Fri, 4 Aug 2023 11:52:12 -0500
From: Vlad Karpovich <vkarpovi@...nsource.cirrus.com>
To: Simon Trimmer <simont@...nsource.cirrus.com>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>
CC: <patches@...nsource.cirrus.com>, <linux-kernel@...r.kernel.org>,
Vlad Karpovich <vkarpovi@...nsource.cirrus.com>
Subject: [PATCH] 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@...nsource.cirrus.com>
---
drivers/firmware/cirrus/cs_dsp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 81cc3d0f6eec..81c5f94b1be1 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -939,7 +939,8 @@ static int cs_dsp_create_control(struct cs_dsp *dsp,
ctl->alg_region.alg == alg_region->alg &&
ctl->alg_region.type == alg_region->type) {
if ((!subname && !ctl->subname) ||
- (subname && !strncmp(ctl->subname, subname, ctl->subname_len))) {
+ (subname && (ctl->subname_len == subname_len) &&
+ !strncmp(ctl->subname, subname, ctl->subname_len))) {
if (!ctl->enabled)
ctl->enabled = 1;
return 0;
--
2.25.1
Powered by blists - more mailing lists