Skip to contentSkip to conversation

ALSA: n64: check return value after calling platform_get_resource()

PATCH Applied Yang Yingliang 2 participants 2 messages Jun 10, 2021 – Jun 12, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 sound/mips/snd-n64.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/mips/snd-n64.c +4 -0
index e35e93157755..463a6fe589eb 100644
@@ -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;
Signature · 1 line
2.25.1