Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6e455f5

Browse files
jnikulamripard
authored andcommitted
drm/crtc: fix uninitialized variable use
Commit 3823119 ("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: 3823119 ("drm/crtc: Fix uninit-value bug in drm_mode_setcrtc") Cc: [email protected] Cc: Ziqi Zhao <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Thomas Zimmermann <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3823119 commit 6e455f5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/gpu/drm/drm_crtc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
715715
struct drm_mode_set set;
716716
uint32_t __user *set_connectors_ptr;
717717
struct drm_modeset_acquire_ctx ctx;
718-
int ret, i, num_connectors;
718+
int ret, i, num_connectors = 0;
719719

720720
if (!drm_core_check_feature(dev, DRIVER_MODESET))
721721
return -EOPNOTSUPP;
@@ -850,7 +850,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
850850
goto out;
851851
}
852852

853-
num_connectors = 0;
854853
for (i = 0; i < crtc_req->count_connectors; i++) {
855854
connector_set[i] = NULL;
856855
set_connectors_ptr = (uint32_t __user *)(unsigned long)crtc_req->set_connectors_ptr;

0 commit comments

Comments
 (0)