From: Yang Yingliang <yangyingliang@huawei.com> To: <linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>, <alsa-devel@alsa-project.org> Cc: <timur@kernel.org>, <broonie@kernel.org> Subject: [PATCH -next 9/9] ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname() Date: Fri, 11 Jun 2021 17:36:26 +0800 [thread overview] Message-ID: <20210611093626.579176-10-yangyingliang@huawei.com> (raw) In-Reply-To: <20210611093626.579176-1-yangyingliang@huawei.com> It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- sound/soc/fsl/fsl_xcvr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index df7c189d97dd..2e9061c5ed74 100644 --- a/sound/soc/fsl/fsl_xcvr.c +++ b/sound/soc/fsl/fsl_xcvr.c @@ -1202,6 +1202,10 @@ static int fsl_xcvr_probe(struct platform_device *pdev) rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo"); tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo"); + if (!rx_res || !tx_res) { + dev_err(dev, "Invalid resource\n"); + return -EINVAL; + } xcvr->dma_prms_rx.chan_name = "rx"; xcvr->dma_prms_tx.chan_name = "tx"; xcvr->dma_prms_rx.addr = rx_res->start; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Yang Yingliang <yangyingliang@huawei.com> To: <linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>, <alsa-devel@alsa-project.org> Cc: broonie@kernel.org, timur@kernel.org Subject: [PATCH -next 9/9] ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname() Date: Fri, 11 Jun 2021 17:36:26 +0800 [thread overview] Message-ID: <20210611093626.579176-10-yangyingliang@huawei.com> (raw) In-Reply-To: <20210611093626.579176-1-yangyingliang@huawei.com> It will cause null-ptr-deref if platform_get_resource_byname() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- sound/soc/fsl/fsl_xcvr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index df7c189d97dd..2e9061c5ed74 100644 --- a/sound/soc/fsl/fsl_xcvr.c +++ b/sound/soc/fsl/fsl_xcvr.c @@ -1202,6 +1202,10 @@ static int fsl_xcvr_probe(struct platform_device *pdev) rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo"); tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo"); + if (!rx_res || !tx_res) { + dev_err(dev, "Invalid resource\n"); + return -EINVAL; + } xcvr->dma_prms_rx.chan_name = "rx"; xcvr->dma_prms_tx.chan_name = "tx"; xcvr->dma_prms_rx.addr = rx_res->start; -- 2.25.1
next prev parent reply other threads:[~2021-06-11 9:33 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-11 9:36 [PATCH -next 0/9] ASoC: fsl: Use devm_platform_get_and_ioremap_resource() Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 1/9] ASoC: fsl_asrc: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 2/9] ASoC: fsl_aud2htx: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 3/9] ASoC: fsl_easrc: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 4/9] ASoC: fsl_esai: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 5/9] ASoC: fsl_micfil: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 6/9] ASoC: fsl_sai: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 7/9] ASoC: fsl_spdif: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` [PATCH -next 8/9] ASoC: fsl_ssi: " Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang 2021-06-11 9:36 ` Yang Yingliang [this message] 2021-06-11 9:36 ` [PATCH -next 9/9] ASoC: fsl_xcvr: check return value after calling platform_get_resource_byname() Yang Yingliang 2021-06-13 14:00 ` Timur Tabi 2021-06-13 14:00 ` Timur Tabi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210611093626.579176-10-yangyingliang@huawei.com \ --to=yangyingliang@huawei.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=timur@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.