[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZTut09A43yidJD9Z@intel.com>
Date: Fri, 27 Oct 2023 15:32:19 +0300
From: Ville Syrjälä <ville.syrjala@...ux.intel.com>
To: Peng Hao <penghao@...gdao.com>
Cc: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] gpu/drm/drm_framebuffer.c: Add judgement for return
value of drm_get_format_info().
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@...gdao.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
Powered by blists - more mailing lists