Re: [PATCH] drm/fsl-dcu: Fix no fb check bug

2015-11-16 Thread Stefan Agner
Hi,

This avoids a NULL pointer dereference when no crtc is available (e.g.
the fsl,panel not assigned).

Any chance to get this into 4.4?

Tested-by: Stefan Agner 

--
Stefan

On 2015-08-30 20:39, Jianwei Wang wrote:
> For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function,
> if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update
> anymore.
> 
> Signed-off-by: Jianwei Wang 
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> index 82be6b8..8787920 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> @@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct
> drm_plane *plane,
>  {
>   struct drm_framebuffer *fb = state->fb;
>  
> + if (!fb)
> + return -EINVAL;
> +
>   switch (fb->pixel_format) {
>   case DRM_FORMAT_RGB565:
>   case DRM_FORMAT_RGB888:
> @@ -84,9 +87,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct
> drm_plane *plane,
>   unsigned int alpha, bpp;
>   int index, ret;
>  
> - if (!fb)
> - return;
> -
>   index = fsl_dcu_drm_plane_index(plane);
>   if (index < 0)
>   return;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] drm/fsl-dcu: Fix no fb check bug

2015-11-16 Thread Stefan Agner
Hi,

This avoids a NULL pointer dereference when no crtc is available (e.g.
the fsl,panel not assigned).

Any chance to get this into 4.4?

Tested-by: Stefan Agner 

--
Stefan

On 2015-08-30 20:39, Jianwei Wang wrote:
> For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function,
> if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update
> anymore.
> 
> Signed-off-by: Jianwei Wang 
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> index 82be6b8..8787920 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> @@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct
> drm_plane *plane,
>  {
>   struct drm_framebuffer *fb = state->fb;
>  
> + if (!fb)
> + return -EINVAL;
> +
>   switch (fb->pixel_format) {
>   case DRM_FORMAT_RGB565:
>   case DRM_FORMAT_RGB888:
> @@ -84,9 +87,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct
> drm_plane *plane,
>   unsigned int alpha, bpp;
>   int index, ret;
>  
> - if (!fb)
> - return;
> -
>   index = fsl_dcu_drm_plane_index(plane);
>   if (index < 0)
>   return;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drm/fsl-dcu: Fix no fb check bug

2015-08-30 Thread Jianwei Wang
For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function,
if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update
anymore.

Signed-off-by: Jianwei Wang 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index 82be6b8..8787920 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane 
*plane,
 {
struct drm_framebuffer *fb = state->fb;
 
+   if (!fb)
+   return -EINVAL;
+
switch (fb->pixel_format) {
case DRM_FORMAT_RGB565:
case DRM_FORMAT_RGB888:
@@ -84,9 +87,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane 
*plane,
unsigned int alpha, bpp;
int index, ret;
 
-   if (!fb)
-   return;
-
index = fsl_dcu_drm_plane_index(plane);
if (index < 0)
return;
-- 
2.1.0.27.g96db324

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drm/fsl-dcu: Fix no fb check bug

2015-08-30 Thread Jianwei Wang
For state-fb may be NULL in fsl_dcu_drm_plane_atomic_check function,
if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update
anymore.

Signed-off-by: Jianwei Wang jianwei.wang@gmail.com
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
index 82be6b8..8787920 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane 
*plane,
 {
struct drm_framebuffer *fb = state-fb;
 
+   if (!fb)
+   return -EINVAL;
+
switch (fb-pixel_format) {
case DRM_FORMAT_RGB565:
case DRM_FORMAT_RGB888:
@@ -84,9 +87,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane 
*plane,
unsigned int alpha, bpp;
int index, ret;
 
-   if (!fb)
-   return;
-
index = fsl_dcu_drm_plane_index(plane);
if (index  0)
return;
-- 
2.1.0.27.g96db324

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/