* [PATCH] Gpu: drm: exynos - Fix possible NULL derefrence.
[not found] <CGME20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162@epcas4p1.samsung.com>
@ 2017-01-30 5:02 ` Shailendra Verma
2017-01-30 12:51 ` Javier Martinez Canillas
0 siblings, 1 reply; 2+ messages in thread
From: Shailendra Verma @ 2017-01-30 5:02 UTC (permalink / raw)
To: Inki Dae, Joonyoung Shim, Seung-Woo Kim, Kyungmin Park,
David Airlie, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, dri-devel, linux-arm-kernel,
linux-samsung-soc, linux-kernel, p.shailesh, ashish.kalra,
Shailendra Verma, Shailendra Verma
of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++++
drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++
drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++++
4 files changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e07cb1f..fba0ffc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1765,6 +1765,10 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->dev = dev;
dsi->driver_data = of_device_get_match_data(dev);
+ if (!dsi->driver_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
ret = exynos_dsi_parse_dt(dsi);
if (ret)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index e2e4051..f568234 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1076,6 +1076,10 @@ static int fimd_probe(struct platform_device *pdev)
ctx->dev = dev;
ctx->suspended = true;
ctx->driver_data = of_device_get_match_data(dev);
+ if (!ctx->driver_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
ctx->vidcon1 |= VIDCON1_INV_VDEN;
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 38eaa63..27aeb74 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1837,6 +1837,10 @@ static int hdmi_probe(struct platform_device *pdev)
return -ENOMEM;
hdata->drv_data = of_device_get_match_data(dev);
+ if (!hdata->drv_data) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
platform_set_drvdata(pdev, hdata);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index edb20a3..b3c6bbb 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1205,6 +1205,10 @@ static int mixer_probe(struct platform_device *pdev)
}
drv = of_device_get_match_data(dev);
+ if (!drv) {
+ dev_err(dev, "no device match found\n");
+ return -ENODEV;
+ }
ctx->pdev = pdev;
ctx->dev = dev;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Gpu: drm: exynos - Fix possible NULL derefrence.
2017-01-30 5:02 ` [PATCH] Gpu: drm: exynos - Fix possible NULL derefrence Shailendra Verma
@ 2017-01-30 12:51 ` Javier Martinez Canillas
0 siblings, 0 replies; 2+ messages in thread
From: Javier Martinez Canillas @ 2017-01-30 12:51 UTC (permalink / raw)
To: Shailendra Verma, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
Kyungmin Park, David Airlie, Kukjin Kim, Krzysztof Kozlowski,
dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel,
p.shailesh, ashish.kalra, Shailendra Verma
Hello Shailendra,
The subject line is wrong, please always use the convention used in
previous commits, i.e: git log --oneline drivers/gpu/drm/exynos/
On 01/30/2017 02:02 AM, Shailendra Verma wrote:
> of_device_get_match_data could return NULL, and so can cause
> a NULL pointer dereference later.
>
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++
> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++++
> drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++
> drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++++
> 4 files changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index e07cb1f..fba0ffc 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1765,6 +1765,10 @@ static int exynos_dsi_probe(struct platform_device *pdev)
>
> dsi->dev = dev;
> dsi->driver_data = of_device_get_match_data(dev);
> + if (!dsi->driver_data) {
> + dev_err(dev, "no device match found\n");
> + return -ENODEV;
> + }
>
I don't think this makes sense for the Exynos driver since Exynos is a
DT-only platform and so the probe callback can only be called if a dev
node with a compatible string in the OF device id table was registered.
All the struct of_device_id in the table have a .data and so this can't
be NULL in this driver.
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-30 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170130050228epcas4p1b880b1ae599b7f7d6c60a4b0554a2162@epcas4p1.samsung.com>
2017-01-30 5:02 ` [PATCH] Gpu: drm: exynos - Fix possible NULL derefrence Shailendra Verma
2017-01-30 12:51 ` Javier Martinez Canillas
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).