mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org,
	"Jianwei Wang <jianwei.wang.chn@gmail.com>" 
	<linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] drm/fsl-dcu: Fix no fb check bug
Date: Mon, 16 Nov 2015 14:34:11 -0800	[thread overview]
Message-ID: <c1f2ea5c161e8bdd4d3c6109543404d0@agner.ch> (raw)
In-Reply-To: <1440992397-40533-1-git-send-email-jianwei.wang.chn@gmail.com>

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@agner.ch>

--
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 <jianwei.wang.chn@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;

      reply	other threads:[~2015-11-16 22:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31  3:39 Jianwei Wang
2015-11-16 22:34 ` Stefan Agner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1f2ea5c161e8bdd4d3c6109543404d0@agner.ch \
    --to=stefan@agner.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®