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

Commit 22d1725e authored by Narendra Muppalla's avatar Narendra Muppalla Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/sde: count null character for blob length



Return value of snprintf doesn't account for the terminating
null character it appends to the end of every string.
So this change adds one extra character length to the blob size
to avoid over reading from the client end.

Change-Id: I8919f0b01dcbcad9300c28e070e9b9ca64368db2
Signed-off-by: default avatarNarendra Muppalla <NarendraM@codeaurora.org>
parent 684a7b03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3020,7 +3020,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
			catalog->perf.min_prefill_lines);

	msm_property_set_blob(&sde_crtc->property_info, &sde_crtc->blob_info,
			info->data, info->len, CRTC_PROP_INFO);
			info->data, SDE_KMS_INFO_DATALEN(info), CRTC_PROP_INFO);

	kfree(info);
}
+3 −1
Original line number Diff line number Diff line
@@ -313,10 +313,12 @@ struct sde_kms_info {

/**
 * SDE_KMS_INFO_DATALEN - Macro for accessing sde_kms_info data length
 *			it adds an extra character length to count null.
 * @S: Pointer to sde_kms_info structure
 * Returns: Size of available byte data
 */
#define SDE_KMS_INFO_DATALEN(S) ((S) ? ((struct sde_kms_info *)(S))->len : 0)
#define SDE_KMS_INFO_DATALEN(S) ((S) ? ((struct sde_kms_info *)(S))->len + 1 \
							: 0)

/**
 * sde_kms_info_reset - reset sde_kms_info structure
+4 −2
Original line number Diff line number Diff line
@@ -2272,7 +2272,8 @@ static void sde_plane_rot_install_caps(struct drm_plane *plane)
				rot_hw->ops.get_maxlinewidth(rot_hw));

	msm_property_set_blob(&psde->property_info, &psde->blob_rot_caps,
			info->data, info->len, PLANE_PROP_ROT_CAPS_V1);
			info->data, SDE_KMS_INFO_DATALEN(info),
			PLANE_PROP_ROT_CAPS_V1);

	sde_hw_rot_put(rot_hw);
error_rot:
@@ -3424,7 +3425,8 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
	sde_kms_info_add_keyint(info, "max_per_pipe_bw",
			psde->pipe_sblk->max_per_pipe_bw * 1000LL);
	msm_property_set_blob(&psde->property_info, &psde->blob_info,
			info->data, info->len, PLANE_PROP_INFO);
			info->data, SDE_KMS_INFO_DATALEN(info),
			PLANE_PROP_INFO);

	kfree(info);
	kfree(virt_format_list);