All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Peng Hao <penghao@dingdao.com>
Cc: tzimmermann@suse.de, linux-kernel@vger.kernel.org,
	mripard@kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] gpu/drm/drm_framebuffer.c: Add judgement for return value of drm_get_format_info().
Date: Fri, 27 Oct 2023 15:32:19 +0300	[thread overview]
Message-ID: <ZTut09A43yidJD9Z@intel.com> (raw)
In-Reply-To: <20231027091912.1244107-1-penghao@dingdao.com>

On Fri, Oct 27, 2023 at 05:19:12PM +0800, Peng Hao wrote:
> Since drm_get_format_info() may return NULL,

Not in this case since we already checked it earlier.

> so a judgement of return
> value is needed to add.
> 
> Signed-off-by: Peng Hao <penghao@dingdao.com>
> ---
>  drivers/gpu/drm/drm_framebuffer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index aff3746dedfb..be7dd1998c04 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -194,6 +194,10 @@ static int framebuffer_check(struct drm_device *dev,
>  
>  	/* now let the driver pick its own format info */
>  	info = drm_get_format_info(dev, r);
> +	if (!info) {
> +		drm_dbg_kms(dev, "no matched format info\n");
> +		return -EFAULT;
> +	}
>  
>  	for (i = 0; i < info->num_planes; i++) {
>  		unsigned int width = fb_plane_width(r->width, info, i);
> -- 
> 2.37.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2023-10-27 12:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  9:19 [PATCH] gpu/drm/drm_framebuffer.c: Add judgement for return value of drm_get_format_info() Peng Hao
2023-10-27  9:19 ` Peng Hao
2023-10-27 12:32 ` Ville Syrjälä [this message]
2023-10-30  9:08   ` 彭昊
2023-10-30  9:24   ` 彭昊
  -- strict thread matches above, loose matches on Subject: below --
2023-10-30  9:30 彭昊

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=ZTut09A43yidJD9Z@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=penghao@dingdao.com \
    --cc=tzimmermann@suse.de \
    /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 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.