From be471fe332f7f14aa6828010b220d7e6902b91a0 Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Thu, 10 Jun 2021 20:49:58 +0800 Subject: ALSA: n64: check return value after calling platform_get_resource() It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20210610124958.116142-1-yangyingliang@huawei.com Signed-off-by: Takashi Iwai --- sound/mips/snd-n64.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound/mips') diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c index e35e93157755..463a6fe589eb 100644 --- a/sound/mips/snd-n64.c +++ b/sound/mips/snd-n64.c @@ -338,6 +338,10 @@ static int __init n64audio_probe(struct platform_device *pdev) strcpy(card->longname, "N64 Audio"); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + err = -EINVAL; + goto fail_dma_alloc; + } if (devm_request_irq(&pdev->dev, res->start, n64audio_isr, IRQF_SHARED, "N64 Audio", priv)) { err = -EBUSY; -- cgit v1.2.3