mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Melissa Wen <mwen@igalia.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>,
	Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>,
	David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Melissa Wen <melissa.srw@gmail.com>,
	dan.carpenter@oracle.com, Igor Torrente <igormtorrente@gmail.com>
Subject: Re: [PATCH] drm/vkms: fix variable dereferenced before check warning
Date: Sat, 10 Sep 2022 18:14:45 -0100	[thread overview]
Message-ID: <20220910191429.ifyzdp54due3u7it@mail.igalia.com> (raw)
In-Reply-To: <20220908105623.72777-1-harshit.m.mogalapalli@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 1344 bytes --]

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@oracle.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@igalia.com>

>  	vkms_plane_state = to_vkms_plane_state(new_state);
>  	shadow_plane_state = &vkms_plane_state->base;
>  
> -- 
> 2.31.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-09-10 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 10:56 Harshit Mogalapalli
2022-09-10 19:14 ` Melissa Wen [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=20220910191429.ifyzdp54due3u7it@mail.igalia.com \
    --to=mwen@igalia.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=igormtorrente@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=melissa.srw@gmail.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    /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®