]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/framebuffer: Fix use of uninitialized variable
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fri, 3 Nov 2023 13:14:04 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:11 +0000 (08:42 +0100)
[ Upstream commit f9af8f0c1dc567a5a6a6318ff324c45d80d4a60f ]

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.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231103-uninit-fixes-v2-2-c22b2444f5f5@ideasonboard.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_framebuffer.c

index 2f5b0c2bb0fe3ff885becc9c6b2cca2e34a255b6..e490ef42441f390cb76d29f28d0c8c7f3e834b61 100644 (file)
@@ -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;