Skip to content

Commit

Permalink
drm/crtc: fix uninitialized variable use
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
jnikula authored and mripard committed Dec 8, 2023
1 parent 3823119 commit 6e455f5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6e455f5

Please sign in to comment.