Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 716746da authored by Shilun Wan's avatar Shilun Wan Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/sde: fix potential array index out of bounds



The num_encoders may exceed the max_encoders, so add one safe condition
to avoid this case.

Change-Id: I38454678f18cb26616ff82eb6f418f2fc0d22fa5
Signed-off-by: default avatarShilun Wan <swan@codeaurora.org>
parent 0b5e81a5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1591,7 +1591,8 @@ static int _sde_kms_setup_displays(struct drm_device *dev,
		/* update display cap to MST_MODE for DP MST encoders */
		info.capabilities |= MSM_DISPLAY_CAP_MST_MODE;
		sde_kms->dp_stream_count = dp_display_get_num_of_streams();
		for (idx = 0; idx < sde_kms->dp_stream_count; idx++) {
		for (idx = 0; idx < sde_kms->dp_stream_count &&
			priv->num_encoders < max_encoders; idx++) {
			info.h_tile_instance[0] = idx;
			encoder = sde_encoder_init(dev, &info);
			if (IS_ERR_OR_NULL(encoder)) {