From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/drm_file: fix use of uninitialized variable
Date: Fri, 4 Aug 2023 16:50:32 +0300 [thread overview]
Message-ID: <20230804135032.GG12951@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230804-uninit-fixes-v1-1-a60772c04db5@ideasonboard.com>
On Fri, Aug 04, 2023 at 01:57:39PM +0300, Tomi Valkeinen wrote:
> smatch reports:
>
> drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.
>
> 'supported_status' is only set in one code path. I'm not familiar with
> the code to say if that path will always be ran in real life, but
> whether that is the case or not, I think it is good to initialize
> 'supported_status' to 0 to silence the warning (and possibly fix a bug).
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/gpu/drm/drm_file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 883d83bc0e3d..cc06e1836bf5 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -924,7 +924,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
> {
> struct drm_gem_object *obj;
> struct drm_memory_stats status = {};
> - enum drm_gem_object_status supported_status;
> + enum drm_gem_object_status supported_status = 0;
> int id;
>
> spin_lock(&file->table_lock);
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-08-04 13:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 10:57 [PATCH 0/2] drm: Fix errors about uninitialized variables Tomi Valkeinen
2023-08-04 10:57 ` [PATCH 1/2] drm/drm_file: fix use of uninitialized variable Tomi Valkeinen
2023-08-04 13:50 ` Laurent Pinchart [this message]
2023-08-04 10:57 ` [PATCH 2/2] drm/framebuffer: Fix " Tomi Valkeinen
2023-08-04 14:06 ` Laurent Pinchart
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=20230804135032.GG12951@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=francesco.dolcini@toradex.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tomi.valkeinen@ideasonboard.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 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®