* [PATCH] Soc: mediatek - Fix possible NULL derefrence.
[not found] <CGME20170127111755epcas4p4f4bf0401e49ddd4563b0365b838d3dde@epcas4p4.samsung.com>
@ 2017-01-27 11:17 ` Shailendra Verma
2017-05-10 11:34 ` Matthias Brugger
0 siblings, 1 reply; 2+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:17 UTC (permalink / raw)
To: Matthias Brugger, John Crispin, Henry Chen, Daniel Kurtz,
Arnd Bergmann, linux-arm-kernel, linux-mediatek, linux-kernel,
p.shailesh, ashish.kalra, Shailendra Verma, Shailendra Verma
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/soc/mediatek/mtk-pmic-wrap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index a5f1093..c48db98 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1117,6 +1117,11 @@ static int pwrap_probe(struct platform_device *pdev)
const struct of_device_id *of_slave_id = NULL;
struct resource *res;
+ if (!of_id) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
if (pdev->dev.of_node->child)
of_slave_id = of_match_node(of_slave_match_tbl,
pdev->dev.of_node->child);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Soc: mediatek - Fix possible NULL derefrence.
2017-01-27 11:17 ` [PATCH] Soc: mediatek - Fix possible NULL derefrence Shailendra Verma
@ 2017-05-10 11:34 ` Matthias Brugger
0 siblings, 0 replies; 2+ messages in thread
From: Matthias Brugger @ 2017-05-10 11:34 UTC (permalink / raw)
To: Shailendra Verma, John Crispin, Henry Chen, Daniel Kurtz,
Arnd Bergmann, linux-arm-kernel, linux-mediatek, linux-kernel,
p.shailesh, ashish.kalra, Shailendra Verma
On 27/01/17 12:17, Shailendra Verma 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>
I fixed the subject line and queued it for v4.12-next/soc
Sorry for the (huge) delay.
Matthias
> ---
> drivers/soc/mediatek/mtk-pmic-wrap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index a5f1093..c48db98 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -1117,6 +1117,11 @@ static int pwrap_probe(struct platform_device *pdev)
> const struct of_device_id *of_slave_id = NULL;
> struct resource *res;
>
> + if (!of_id) {
> + dev_err(&pdev->dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> +
> if (pdev->dev.of_node->child)
> of_slave_id = of_match_node(of_slave_match_tbl,
> pdev->dev.of_node->child);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-10 11:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170127111755epcas4p4f4bf0401e49ddd4563b0365b838d3dde@epcas4p4.samsung.com>
2017-01-27 11:17 ` [PATCH] Soc: mediatek - Fix possible NULL derefrence Shailendra Verma
2017-05-10 11:34 ` Matthias Brugger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).