* [PATCH 0/2] drm: Fix errors about uninitialized variables
@ 2023-08-04 10:57 Tomi Valkeinen
2023-08-04 10:57 ` [PATCH 1/2] drm/drm_file: fix use of uninitialized variable Tomi Valkeinen
2023-08-04 10:57 ` [PATCH 2/2] drm/framebuffer: Fix " Tomi Valkeinen
0 siblings, 2 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2023-08-04 10:57 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Laurent Pinchart, Francesco Dolcini
Cc: dri-devel, linux-kernel, Tomi Valkeinen
Fix two cases where smatch reports a use of an uninitialized variable.
Tomi
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
Tomi Valkeinen (2):
drm/drm_file: fix use of uninitialized variable
drm/framebuffer: Fix use of uninitialized variable
drivers/gpu/drm/drm_file.c | 2 +-
drivers/gpu/drm/drm_framebuffer.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: b0e9267d4ccce9be9217337f4bc364ca24cf7f73
change-id: 20230804-uninit-fixes-188f92d60ac3
Best regards,
--
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/drm_file: fix use of uninitialized variable
2023-08-04 10:57 [PATCH 0/2] drm: Fix errors about uninitialized variables Tomi Valkeinen
@ 2023-08-04 10:57 ` Tomi Valkeinen
2023-08-04 13:50 ` Laurent Pinchart
2023-08-04 10:57 ` [PATCH 2/2] drm/framebuffer: Fix " Tomi Valkeinen
1 sibling, 1 reply; 5+ messages in thread
From: Tomi Valkeinen @ 2023-08-04 10:57 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Laurent Pinchart, Francesco Dolcini
Cc: dri-devel, linux-kernel, Tomi Valkeinen
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>
---
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);
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/framebuffer: Fix use of uninitialized variable
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 10:57 ` Tomi Valkeinen
2023-08-04 14:06 ` Laurent Pinchart
1 sibling, 1 reply; 5+ messages in thread
From: Tomi Valkeinen @ 2023-08-04 10:57 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Laurent Pinchart, Francesco Dolcini
Cc: dri-devel, linux-kernel, Tomi Valkeinen
smatch reports:
drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'.
'ret' is possibly not set when there are no errors, causing the error
above. I can't say if that ever happens in real-life, but in any case I
think it is good to initialize 'ret' to 0.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/drm_framebuffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index aff3746dedfb..1955eaeba0ab 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -570,7 +570,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
struct drm_mode_fb_cmd2 *r = data;
struct drm_framebuffer *fb;
unsigned int i;
- int ret;
+ int ret = 0;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/drm_file: fix use of uninitialized variable
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
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2023-08-04 13:50 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Francesco Dolcini, dri-devel,
linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/framebuffer: Fix use of uninitialized variable
2023-08-04 10:57 ` [PATCH 2/2] drm/framebuffer: Fix " Tomi Valkeinen
@ 2023-08-04 14:06 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2023-08-04 14:06 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Francesco Dolcini, dri-devel,
linux-kernel
On Fri, Aug 04, 2023 at 01:57:40PM +0300, Tomi Valkeinen wrote:
> smatch reports:
>
> drivers/gpu/drm/drm_framebuffer.c:654 drm_mode_getfb2_ioctl() error: uninitialized symbol 'ret'.
>
> 'ret' is possibly not set when there are no errors, causing the error
> above. I can't say if that ever happens in real-life, but in any case I
> think it is good to initialize 'ret' to 0.
I don't think it can happen in practice, but tools have no way to know
that.
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
> drivers/gpu/drm/drm_framebuffer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index aff3746dedfb..1955eaeba0ab 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -570,7 +570,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
> struct drm_mode_fb_cmd2 *r = data;
> struct drm_framebuffer *fb;
> unsigned int i;
> - int ret;
> + int ret = 0;
>
> if (!drm_core_check_feature(dev, DRIVER_MODESET))
> return -EINVAL;
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-04 14:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-08-04 10:57 ` [PATCH 2/2] drm/framebuffer: Fix " Tomi Valkeinen
2023-08-04 14:06 ` Laurent Pinchart
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®