[PATCH] drm/crtc: fix uninitialized variable use
Jani Nikula
jani.nikula at intel.com
Fri Dec 8 13:12:38 UTC 2023
Commit 3823119b9c2b ("drm/crtc: Fix uninit-value bug in
drm_mode_setcrtc") was supposed to fix use of an uninitialized variable,
but introduced another.
num_connectors is only initialized if crtc_req->count_connectors > 0,
but it's used regardless. Fix it.
Fixes: 3823119b9c2b ("drm/crtc: Fix uninit-value bug in drm_mode_setcrtc")
Cc: syzbot+4fad2e57beb6397ab2fc at syzkaller.appspotmail.com
Cc: Ziqi Zhao <astrajoan at yahoo.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/drm_crtc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d718c17ab1e9..cb90e70d85e8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -715,7 +715,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
struct drm_mode_set set;
uint32_t __user *set_connectors_ptr;
struct drm_modeset_acquire_ctx ctx;
- int ret, i, num_connectors;
+ int ret, i, num_connectors = 0;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EOPNOTSUPP;
@@ -850,7 +850,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out;
}
- num_connectors = 0;
for (i = 0; i < crtc_req->count_connectors; i++) {
connector_set[i] = NULL;
set_connectors_ptr = (uint32_t __user *)(unsigned long)crtc_req->set_connectors_ptr;
--
2.39.2
More information about the Intel-gfx
mailing list