ALSA: korg1212: Fix crash in snd_korg1212_create()
Subsystems (2)
PATCH 1/1 ALSA: korg1212: Fix crash in snd_korg1212_create()
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 <[email protected]>
--- sound/pci/korg1212/korg1212.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/pci/korg1212/korg1212.c +5 -5
@@ -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]);
Signature · 1 line
2.20.1
Quoted 6 lines · Dan Carpenter
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 <[email protected]>
Thanks, it's already addressed by commit d364a600d6ed.
Takashi