Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp486498pxj; Thu, 10 Jun 2021 05:48:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR2sSj217ZqOwxxlrEJ0/eAXMncSlFjp4Ak8doFhGDcjV0Y6zAmrk5SGk3WGeioQKl1rxE X-Received: by 2002:a17:906:5947:: with SMTP id g7mr4350326ejr.351.1623329307481; Thu, 10 Jun 2021 05:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623329307; cv=none; d=google.com; s=arc-20160816; b=kLo2Ryxs275vpYzz4jdYDCgUEz+DXq0BTl0KK+m0iB5I6k0dP21N2xMg2Ta4to+fc5 fn+cstGMlrKqTMIVVC+Bhp3vWR2OYhjydkgGIgUwOiZkVTCjnOT84/bvzqgWqr84cZwS SC5W1t13ZVLngjrCahOuL01lO3pMZpOVMWDCKfIOhtgCerlMcu1jSj3bmPb4iaz2Bcv8 dwYam+v3sV3Bi0lSnSLpslgtFbXbSNM1UFcsT4K2ykfzshvafDH90zQPVka2sE1Gi0XB TtM3DVSfFPKdKRZYlU1HOa9F+N0AFXSlhBOAWC5NptLXnI+R0qn84sqWYgE9cta5f92c L5bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=c5ZCkkSsMiJNC2eB4Y0fTbmyZbzvLpY6QJfr3GrMx5Q=; b=C1jFdv6tH6RjqReZHx0qL4Gun3D2Bu2TsUgUYyODbCc2pz01H0xknyBjbc8x7oUPfH qmaVIBMTe9u75u3jPjO4Masq4zplORlx7Ye0t0UHMuKlXhZqZDqswHPoXftDuSdp82lv 4O7eQ6FQ+a46trPlWmzprgwo5R6n2uCicDfQw3VAkUVi7WRnZHbIo5uheGa/IkMGjX93 2oThmyHIyditMZqZv/rCMW6qd/KuuFJefu3SXlryNQvEJom8dqNNGPVKWM+hXJJCWS2Y eU47ScHKnghfh6DuhbA84Dm5+OvnTXU5N3Okeli0O3pw7h5FzSZcfB981fwyjB9GSDo9 iL0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si2459159edi.368.2021.06.10.05.48.04; Thu, 10 Jun 2021 05:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbhFJMru (ORCPT + 99 others); Thu, 10 Jun 2021 08:47:50 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:5326 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbhFJMrt (ORCPT ); Thu, 10 Jun 2021 08:47:49 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4G13Vf0qXvz1BL5P; Thu, 10 Jun 2021 20:40:58 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 10 Jun 2021 20:45:51 +0800 Received: from huawei.com (10.175.103.91) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 10 Jun 2021 20:45:51 +0800 From: Yang Yingliang To: , CC: Subject: [PATCH -next] ALSA: n64: check return value after calling platform_get_resource() Date: Thu, 10 Jun 2021 20:49:58 +0800 Message-ID: <20210610124958.116142-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang --- sound/mips/snd-n64.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.25.1