From: Hui Tang <tanghui20@huawei.com>
To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
<u.kleine-koenig@pengutronix.de>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<weiyongjun1@huawei.com>, <yusongping@huawei.com>
Subject: [PATCH] mtd: lpddr2_nvm: i2c: mux: reg: Fix possible null-ptr-deref
Date: Mon, 14 Nov 2022 10:01:41 +0800 [thread overview]
Message-ID: <20221114020141.28138-1-tanghui20@huawei.com> (raw)
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))
+ return -ENODEV;
/* Populate map_info data structure */
*map = (struct map_info) {
--
2.17.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Hui Tang <tanghui20@huawei.com>
To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
<u.kleine-koenig@pengutronix.de>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<weiyongjun1@huawei.com>, <yusongping@huawei.com>
Subject: [PATCH] mtd: lpddr2_nvm: i2c: mux: reg: Fix possible null-ptr-deref
Date: Mon, 14 Nov 2022 10:01:41 +0800 [thread overview]
Message-ID: <20221114020141.28138-1-tanghui20@huawei.com> (raw)
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))
+ return -ENODEV;
/* Populate map_info data structure */
*map = (struct map_info) {
--
2.17.1
next reply other threads:[~2022-11-14 2:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 2:01 Hui Tang [this message]
2022-11-14 2:01 ` [PATCH] mtd: lpddr2_nvm: i2c: mux: reg: Fix possible null-ptr-deref Hui Tang
2022-11-14 8:04 ` Miquel Raynal
2022-11-14 8:04 ` Miquel Raynal
2022-11-14 8:30 ` Hui Tang
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=20221114020141.28138-1-tanghui20@huawei.com \
--to=tanghui20@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--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 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.