Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569391 > unrolled thread
| Started by | Shailendra Verma <shailendra.v@samsung.com> |
|---|---|
| First post | 2017-01-30 06:10 +0100 |
| Last post | 2017-01-30 09:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH] Mtd: nand - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:10 +0100
Re: [PATCH] Mtd: nand - Fix possible NULL derefrence. Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-01-30 09:10 +0100
| From | Shailendra Verma <shailendra.v@samsung.com> |
|---|---|
| Date | 2017-01-30 06:10 +0100 |
| Subject | [PATCH] Mtd: nand - Fix possible NULL derefrence. |
| Message-ID | <t5co1-8ip-5@gated-at.bofh.it> |
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/mtd/nand/mxc_nand.c | 4 ++++
drivers/mtd/nand/vf610_nfc.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index d7f724b..ca1b8ad 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1596,6 +1596,10 @@ static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
if (!np)
return 1;
+ if (!of_id) {
+ dev_err(host->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
host->devtype_data = of_id->data;
return 0;
diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
index 3ad514c..0e09c11 100644
--- a/drivers/mtd/nand/vf610_nfc.c
+++ b/drivers/mtd/nand/vf610_nfc.c
@@ -674,6 +674,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
}
of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
+ if (!of_id) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
nfc->variant = (enum vf610_nfc_variant)of_id->data;
for_each_available_child_of_node(nfc->dev->of_node, child) {
--
1.7.9.5
[toc] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2017-01-30 09:10 +0100 |
| Message-ID | <t5fce-1Ac-15@gated-at.bofh.it> |
| In reply to | #1569391 |
Hi Shailendra,
Marek and I already reviewed this patch, and you're resending it
without any of the comments addressed. Is this a mistake?
On Mon, 30 Jan 2017 10:29:17 +0530
Shailendra Verma <shailendra.v@samsung.com> wrote:
> of_match_device could return NULL, and so can cause a NULL
> pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/mtd/nand/mxc_nand.c | 4 ++++
> drivers/mtd/nand/vf610_nfc.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index d7f724b..ca1b8ad 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1596,6 +1596,10 @@ static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
> if (!np)
> return 1;
>
> + if (!of_id) {
> + dev_err(host->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> host->devtype_data = of_id->data;
>
> return 0;
> diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
> index 3ad514c..0e09c11 100644
> --- a/drivers/mtd/nand/vf610_nfc.c
> +++ b/drivers/mtd/nand/vf610_nfc.c
> @@ -674,6 +674,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
> }
>
> of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
> + if (!of_id) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> nfc->variant = (enum vf610_nfc_variant)of_id->data;
>
> for_each_available_child_of_node(nfc->dev->of_node, child) {
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web