Skip to contentSkip to conversation

SDCA Bug Fixes

PATCH In review Charles Keepax 2 participants 5 messages Jul 15, 2025 – Jul 16, 2025

Subsystems (3)
lore
Share & tools
lore

Charles Keepax

author maintainer
#0 lore raw

cover SDCA Bug Fixes

Some small SDCA bug fixes reported from various sources. An array bounds check, an uninitialised variable and some memory allocations that should zero initialise.

Charles Keepax (3):
ASoC: SDCA: Fix off by one error in IRQ bound check
ASoC: SDCA: Avoid use of uninitialised local name variable
ASoC: SDCA: Update memory allocations to zero initialise

 sound/soc/sdca/sdca_asoc.c       | 12 ++++++------
 sound/soc/sdca/sdca_interrupts.c |  5 ++---
 2 files changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.39.5
author maintainer
#1 lore raw

PATCH 1/3 ASoC: SDCA: Fix off by one error in IRQ bound check

---
 sound/soc/sdca/sdca_interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdca/sdca_interrupts.c +1 -1
index 2f85fcc6e5446..eb9e7eff4b4ba 100644
@@ -262,7 +262,7 @@ int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *info,
 {
 	int ret;
 
-	if (sdca_irq < 0 || sdca_irq > SDCA_MAX_INTERRUPTS) {
+	if (sdca_irq < 0 || sdca_irq >= SDCA_MAX_INTERRUPTS) {
 		dev_err(dev, "bad irq request: %d\n", sdca_irq);
 		return -EINVAL;
 	}
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH 2/3 ASoC: SDCA: Avoid use of uninitialised local name variable

In reply to Charles Keepax

The local name variable is accidentally left over from an earlier version of the code. Remove the variable and its uninitialised usage.

---
 sound/soc/sdca/sdca_interrupts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/sdca/sdca_interrupts.c +1 -2
index eb9e7eff4b4ba..b76512732af87 100644
@@ -342,7 +342,6 @@ int sdca_irq_populate(struct sdca_function_data *function,
 			int irq = control->interrupt_position;
 			struct sdca_interrupt *interrupt;
 			irq_handler_t handler;
-			const char *name;
 			int ret;
 
 			if (irq == SDCA_NO_INTERRUPT) {
@@ -385,7 +384,7 @@ int sdca_irq_populate(struct sdca_function_data *function,
 						      handler, interrupt);
 			if (ret) {
 				dev_err(dev, "failed to request irq %s: %d\n",
-					name, ret);
+					interrupt->name, ret);
 				return ret;
 			}
 		}
Signature · 1 line
2.39.5
author maintainer
#3 lore raw

PATCH 3/3 ASoC: SDCA: Update memory allocations to zero initialise

In reply to Charles Keepax

All the memory allocations in the SDCA ASoC helpers rely on fields being zero initialised, the code should use kzalloc not kmalloc.

Fixes 2c8b3a8e6aa8 ("ASoC: SDCA: Create DAPM widgets and routes from DisCo")
Fixes c3ca24e3fcb6 ("ASoC: SDCA: Create ALSA controls from DisCo")
---
 sound/soc/sdca/sdca_asoc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/sdca/sdca_asoc.c +6 -6
index dd7b19083c85f..ebb1c87facf9c 100644
@@ -230,11 +230,11 @@ static int entity_early_parse_ge(struct device *dev,
 	if (!control_name)
 		return -ENOMEM;
 
-	kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
+	kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
 	if (!kctl)
 		return -ENOMEM;
 
-	soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
+	soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
 	if (!soc_enum)
 		return -ENOMEM;
 
@@ -561,11 +561,11 @@ static int entity_parse_su_class(struct device *dev,
 	const char **texts;
 	int i;
 
-	kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
+	kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
 	if (!kctl)
 		return -ENOMEM;
 
-	soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
+	soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
 	if (!soc_enum)
 		return -ENOMEM;
 
@@ -672,7 +672,7 @@ static int entity_parse_mu(struct device *dev,
 		if (!control_name)
 			return -ENOMEM;
 
-		mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
+		mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
 		if (!mc)
 			return -ENOMEM;
 
@@ -926,7 +926,7 @@ static int populate_control(struct device *dev,
 	if (!control_name)
 		return -ENOMEM;
 
-	mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
+	mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
 	if (!mc)
 		return -ENOMEM;
 
Signature · 1 line
2.39.5
maintainer
#4 lore raw
In reply to Charles Keepax
Quoted 10 lines · Charles Keepax

Some small SDCA bug fixes reported from various sources. An array bounds check, an uninitialised variable and some memory allocations that should zero initialise.

Charles Keepax (3):
ASoC: SDCA: Fix off by one error in IRQ bound check
ASoC: SDCA: Avoid use of uninitialised local name variable
ASoC: SDCA: Update memory allocations to zero initialise

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: SDCA: Fix off by one error in IRQ bound check

      commit: 3f2e4c11925ee24a34853b0d608ab85df2430555
[2/3] ASoC: SDCA: Avoid use of uninitialised local name variable
      commit: 71562278a189af2ca202eafa0ab71a9b68469207
[3/3] ASoC: SDCA: Update memory allocations to zero initialise
      commit: 15247b5a63f506125360fa45d7aa1fbe8b903b95

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark