[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220910191429.ifyzdp54due3u7it@mail.igalia.com>
Date: Sat, 10 Sep 2022 18:14:45 -0100
From: Melissa Wen <mwen@...lia.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: Haneen Mohammed <hamohammed.sa@...il.com>,
Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
David Airlie <airlied@...ux.ie>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
Melissa Wen <melissa.srw@...il.com>, dan.carpenter@...cle.com,
Igor Torrente <igormtorrente@...il.com>
Subject: Re: [PATCH] drm/vkms: fix variable dereferenced before check warning
On 09/08, Harshit Mogalapalli wrote:
> Smatch warns:
>
> drivers/gpu/drm/vkms/vkms_plane.c:110 vkms_plane_atomic_update() warn:
> variable dereferenced before check 'fb' (see line 108)
>
> Fix the warning by moving the dereference after the NULL check.
>
> Fixes: 8ba1648567e2 ("drm: vkms: Refactor the plane composer to accept new formats")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
> ---
> drivers/gpu/drm/vkms/vkms_plane.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index f4319066adcc..c3a845220e10 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -105,11 +105,12 @@ static void vkms_plane_atomic_update(struct drm_plane *plane,
> struct drm_shadow_plane_state *shadow_plane_state;
> struct drm_framebuffer *fb = new_state->fb;
> struct vkms_frame_info *frame_info;
> - u32 fmt = fb->format->format;
> + u32 fmt;
>
> if (!new_state->crtc || !fb)
> return;
>
> + fmt = fb->format->format;
Hi Harshit,
Nice catch.
Thanks,
Reviewed-by: Melissa Wen <mwen@...lia.com>
> vkms_plane_state = to_vkms_plane_state(new_state);
> shadow_plane_state = &vkms_plane_state->base;
>
> --
> 2.31.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists