* [PATCH] sound: echoaudio: add a check for ioremap_nocache
@ 2019-03-15 3:58 Kangjie Lu
2019-03-16 9:32 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15 3:58 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Jaroslav Kysela, Takashi Iwai, Gustavo A. R. Silva,
alsa-devel, linux-kernel
In case ioremap_nocache fails, the fix releases chip and returns
an error code upstream to avoid NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
sound/pci/echoaudio/echoaudio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index ea876b0b02b9..dc0084dc8550 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1952,6 +1952,11 @@ static int snd_echo_create(struct snd_card *card,
}
chip->dsp_registers = (volatile u32 __iomem *)
ioremap_nocache(chip->dsp_registers_phys, sz);
+ if (!chip->dsp_registers) {
+ dev_err(chip->card->dev, "ioremap failed\n");
+ snd_echo_free(chip);
+ return -ENOMEM;
+ }
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-16 9:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 3:58 [PATCH] sound: echoaudio: add a check for ioremap_nocache Kangjie Lu
2019-03-16 9:32 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®