From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Hui Tang <tanghui20@huawei.com>
Cc: <richard@nod.at>, <vigneshr@ti.com>,
<u.kleine-koenig@pengutronix.de>, <linux-mtd@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <weiyongjun1@huawei.com>,
<yusongping@huawei.com>
Subject: Re: [PATCH] mtd: lpddr2_nvm: i2c: mux: reg: Fix possible null-ptr-deref
Date: Mon, 14 Nov 2022 09:04:08 +0100 [thread overview]
Message-ID: <20221114090408.7ed0e7c1@xps-13> (raw)
In-Reply-To: <20221114020141.28138-1-tanghui20@huawei.com>
Hi Hui,
tanghui20@huawei.com wrote on Mon, 14 Nov 2022 10:01:41 +0800:
> It will cause null-ptr-deref when resource_size(add_range) invoked,
> if platform_get_resource() returns NULL.
>
> Fixes: 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
> Signed-off-by: Hui Tang <tanghui20@huawei.com>
> ---
> drivers/mtd/lpddr/lpddr2_nvm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c
> index 367e2d906de0..cf8e86eb4b2c 100644
> --- a/drivers/mtd/lpddr/lpddr2_nvm.c
> +++ b/drivers/mtd/lpddr/lpddr2_nvm.c
> @@ -433,6 +433,8 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
>
> /* lpddr2_nvm address range */
> add_range = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (IS_ERR(add_range))
platform_get_resource() just returns NULL upon error.
> + return -ENODEV;
>
> /* Populate map_info data structure */
> *map = (struct map_info) {
Thanks,
Miquèl
next prev parent reply other threads:[~2022-11-14 8:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 2:01 Hui Tang
2022-11-14 8:04 ` Miquel Raynal [this message]
2022-11-14 8:30 ` Hui Tang
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=20221114090408.7ed0e7c1@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=tanghui20@huawei.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vigneshr@ti.com \
--cc=weiyongjun1@huawei.com \
--cc=yusongping@huawei.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®