Skip to content

Commit 3f998cd

Browse files
committed
SDCA Bug Fixes
Merge series from Charles Keepax <[email protected]>: 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(-) -- 2.39.5
2 parents dd10ed1 + 15247b5 commit 3f998cd

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

sound/soc/sdca/sdca_asoc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ static int entity_early_parse_ge(struct device *dev,
230230
if (!control_name)
231231
return -ENOMEM;
232232

233-
kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
233+
kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
234234
if (!kctl)
235235
return -ENOMEM;
236236

237-
soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
237+
soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
238238
if (!soc_enum)
239239
return -ENOMEM;
240240

@@ -561,11 +561,11 @@ static int entity_parse_su_class(struct device *dev,
561561
const char **texts;
562562
int i;
563563

564-
kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
564+
kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
565565
if (!kctl)
566566
return -ENOMEM;
567567

568-
soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
568+
soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
569569
if (!soc_enum)
570570
return -ENOMEM;
571571

@@ -672,7 +672,7 @@ static int entity_parse_mu(struct device *dev,
672672
if (!control_name)
673673
return -ENOMEM;
674674

675-
mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
675+
mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
676676
if (!mc)
677677
return -ENOMEM;
678678

@@ -926,7 +926,7 @@ static int populate_control(struct device *dev,
926926
if (!control_name)
927927
return -ENOMEM;
928928

929-
mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
929+
mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
930930
if (!mc)
931931
return -ENOMEM;
932932

sound/soc/sdca/sdca_interrupts.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *info,
262262
{
263263
int ret;
264264

265-
if (sdca_irq < 0 || sdca_irq > SDCA_MAX_INTERRUPTS) {
265+
if (sdca_irq < 0 || sdca_irq >= SDCA_MAX_INTERRUPTS) {
266266
dev_err(dev, "bad irq request: %d\n", sdca_irq);
267267
return -EINVAL;
268268
}
@@ -342,7 +342,6 @@ int sdca_irq_populate(struct sdca_function_data *function,
342342
int irq = control->interrupt_position;
343343
struct sdca_interrupt *interrupt;
344344
irq_handler_t handler;
345-
const char *name;
346345
int ret;
347346

348347
if (irq == SDCA_NO_INTERRUPT) {
@@ -385,7 +384,7 @@ int sdca_irq_populate(struct sdca_function_data *function,
385384
handler, interrupt);
386385
if (ret) {
387386
dev_err(dev, "failed to request irq %s: %d\n",
388-
name, ret);
387+
interrupt->name, ret);
389388
return ret;
390389
}
391390
}

0 commit comments

Comments
 (0)