* [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create()
@ 2021-07-21 14:01 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-07-21 14:01 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Takashi Iwai, Leon Romanovsky, alsa-devel, kernel-janitors
The "dsp_code" is not initialized until the next line so we can't
dereference it.
Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
sound/pci/korg1212/korg1212.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 7872abbd4587..3b2df5d06839 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2256,17 +2256,17 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci)
korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
offsetof(struct KorgSharedBuffer, AdatTimeCode);
- korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
- dsp_code->size);
- if (!korg1212->dma_dsp)
- return -ENOMEM;
-
err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
if (err < 0) {
snd_printk(KERN_ERR "firmware not available\n");
return err;
}
+ korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
+ dsp_code->size);
+ if (!korg1212->dma_dsp)
+ return -ENOMEM;
+
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n",
korg1212->dma_dsp->area, korg1212->dma_dsp->addr, dsp_code->size,
stateName[korg1212->cardState]);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create()
@ 2021-07-21 14:01 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-07-21 14:01 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: alsa-devel, kernel-janitors, Takashi Iwai, Leon Romanovsky
The "dsp_code" is not initialized until the next line so we can't
dereference it.
Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
sound/pci/korg1212/korg1212.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 7872abbd4587..3b2df5d06839 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2256,17 +2256,17 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci)
korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
offsetof(struct KorgSharedBuffer, AdatTimeCode);
- korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
- dsp_code->size);
- if (!korg1212->dma_dsp)
- return -ENOMEM;
-
err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
if (err < 0) {
snd_printk(KERN_ERR "firmware not available\n");
return err;
}
+ korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
+ dsp_code->size);
+ if (!korg1212->dma_dsp)
+ return -ENOMEM;
+
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n",
korg1212->dma_dsp->area, korg1212->dma_dsp->addr, dsp_code->size,
stateName[korg1212->cardState]);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create()
2021-07-21 14:01 ` Dan Carpenter
@ 2021-07-21 14:04 ` Takashi Iwai
-1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-07-21 14:04 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jaroslav Kysela, Takashi Iwai, Leon Romanovsky, alsa-devel,
kernel-janitors
On Wed, 21 Jul 2021 16:01:22 +0200,
Dan Carpenter wrote:
>
> The "dsp_code" is not initialized until the next line so we can't
> dereference it.
>
> Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, it's already addressed by commit d364a600d6ed.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create()
@ 2021-07-21 14:04 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-07-21 14:04 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel, kernel-janitors, Takashi Iwai, Leon Romanovsky
On Wed, 21 Jul 2021 16:01:22 +0200,
Dan Carpenter wrote:
>
> The "dsp_code" is not initialized until the next line so we can't
> dereference it.
>
> Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, it's already addressed by commit d364a600d6ed.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-21 14:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 14:01 [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create() Dan Carpenter
2021-07-21 14:01 ` Dan Carpenter
2021-07-21 14:04 ` Takashi Iwai
2021-07-21 14:04 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.