* [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
[not found] <CGME20170127111200epcas3p34bf747c6c3c0da798ddaf34788d1a324@epcas3p3.samsung.com>
2017-01-27 11:11 ` Shailendra Verma
@ 2017-01-27 11:11 ` Shailendra Verma
0 siblings, 0 replies; 6+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:11 UTC (permalink / raw)
To: Mark Yao, David Airlie, Heiko Stuebner, dri-devel,
linux-arm-kernel, linux-rockchip, 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/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index ca22e5e..dbb99cf 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
void *data)
{
- const struct of_device_id *of_id =
- of_match_device(dw_mipi_dsi_dt_ids, dev);
- const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
+ const struct of_device_id *of_id;
+ const struct dw_mipi_dsi_plat_data *pdata;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = data;
struct dw_mipi_dsi *dsi;
struct resource *res;
int ret;
+ of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
+ if (!of_id) {
+ dev_err(dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
+ pdata = of_id->data;
+
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
return -ENOMEM;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
@ 2017-01-27 11:11 ` Shailendra Verma
0 siblings, 0 replies; 6+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:11 UTC (permalink / raw)
To: Mark Yao, David Airlie, Heiko Stuebner,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
p.shailesh-Sze3O3UU22JBDgjK7y7TUQ,
ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ, 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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index ca22e5e..dbb99cf 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
void *data)
{
- const struct of_device_id *of_id =
- of_match_device(dw_mipi_dsi_dt_ids, dev);
- const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
+ const struct of_device_id *of_id;
+ const struct dw_mipi_dsi_plat_data *pdata;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = data;
struct dw_mipi_dsi *dsi;
struct resource *res;
int ret;
+ of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
+ if (!of_id) {
+ dev_err(dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
+ pdata = of_id->data;
+
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
return -ENOMEM;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
@ 2017-01-27 11:11 ` Shailendra Verma
0 siblings, 0 replies; 6+ messages in thread
From: Shailendra Verma @ 2017-01-27 11:11 UTC (permalink / raw)
To: linux-arm-kernel
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/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index ca22e5e..dbb99cf 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
void *data)
{
- const struct of_device_id *of_id =
- of_match_device(dw_mipi_dsi_dt_ids, dev);
- const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
+ const struct of_device_id *of_id;
+ const struct dw_mipi_dsi_plat_data *pdata;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = data;
struct dw_mipi_dsi *dsi;
struct resource *res;
int ret;
+ of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
+ if (!of_id) {
+ dev_err(dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
+ pdata = of_id->data;
+
dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
if (!dsi)
return -ENOMEM;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
2017-01-27 11:11 ` Shailendra Verma
(?)
@ 2017-01-27 12:43 ` Corentin Labbe
-1 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:43 UTC (permalink / raw)
To: Shailendra Verma
Cc: Mark Yao, David Airlie, Heiko Stuebner, dri-devel,
linux-arm-kernel, linux-rockchip, linux-kernel, p.shailesh,
ashish.kalra, Shailendra Verma
On Fri, Jan 27, 2017 at 04:41:50PM +0530, 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>
> ---
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index ca22e5e..dbb99cf 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
> static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
> void *data)
> {
> - const struct of_device_id *of_id =
> - of_match_device(dw_mipi_dsi_dt_ids, dev);
> - const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
> + const struct of_device_id *of_id;
> + const struct dw_mipi_dsi_plat_data *pdata;
> struct platform_device *pdev = to_platform_device(dev);
> struct drm_device *drm = data;
> struct dw_mipi_dsi *dsi;
> struct resource *res;
> int ret;
>
> + of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
> + if (!of_id) {
> + dev_err(dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> +
> + pdata = of_id->data;
> +
> dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
> if (!dsi)
> return -ENOMEM;
Hello
You could use of_device_get_match_data()
Regards
Corentin Labbe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
@ 2017-01-27 12:43 ` Corentin Labbe
0 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:43 UTC (permalink / raw)
To: Shailendra Verma
Cc: ashish.kalra, linux-kernel, dri-devel, linux-rockchip,
p.shailesh, Shailendra Verma, linux-arm-kernel
On Fri, Jan 27, 2017 at 04:41:50PM +0530, 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>
> ---
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index ca22e5e..dbb99cf 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
> static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
> void *data)
> {
> - const struct of_device_id *of_id =
> - of_match_device(dw_mipi_dsi_dt_ids, dev);
> - const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
> + const struct of_device_id *of_id;
> + const struct dw_mipi_dsi_plat_data *pdata;
> struct platform_device *pdev = to_platform_device(dev);
> struct drm_device *drm = data;
> struct dw_mipi_dsi *dsi;
> struct resource *res;
> int ret;
>
> + of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
> + if (!of_id) {
> + dev_err(dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> +
> + pdata = of_id->data;
> +
> dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
> if (!dsi)
> return -ENOMEM;
Hello
You could use of_device_get_match_data()
Regards
Corentin Labbe
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence.
@ 2017-01-27 12:43 ` Corentin Labbe
0 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2017-01-27 12:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 27, 2017 at 04:41:50PM +0530, 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>
> ---
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index ca22e5e..dbb99cf 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -1082,15 +1082,22 @@ static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
> static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
> void *data)
> {
> - const struct of_device_id *of_id =
> - of_match_device(dw_mipi_dsi_dt_ids, dev);
> - const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
> + const struct of_device_id *of_id;
> + const struct dw_mipi_dsi_plat_data *pdata;
> struct platform_device *pdev = to_platform_device(dev);
> struct drm_device *drm = data;
> struct dw_mipi_dsi *dsi;
> struct resource *res;
> int ret;
>
> + of_id = of_match_device(dw_mipi_dsi_dt_ids, dev);
> + if (!of_id) {
> + dev_err(dev, "Error: No device match found\n");
> + return -ENODEV;
> + }
> +
> + pdata = of_id->data;
> +
> dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
> if (!dsi)
> return -ENOMEM;
Hello
You could use of_device_get_match_data()
Regards
Corentin Labbe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-01-27 12:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170127111200epcas3p34bf747c6c3c0da798ddaf34788d1a324@epcas3p3.samsung.com>
2017-01-27 11:11 ` [PATCH] Gpu: drm: rockchip - Fix possible NULL derefrence Shailendra Verma
2017-01-27 11:11 ` Shailendra Verma
2017-01-27 11:11 ` Shailendra Verma
2017-01-27 12:43 ` Corentin Labbe
2017-01-27 12:43 ` Corentin Labbe
2017-01-27 12:43 ` Corentin Labbe
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.