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

Commit a6276183 authored by Yujun Zhang's avatar Yujun Zhang
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: I4aa74b4c49171d642829b331a88f5960a7d25793
CRs-Fixed: 2044242
Signed-off-by: default avatarNarendra Muppalla <NarendraM@codeaurora.org>
Signed-off-by: default avatarYujun Zhang <yujunzhang@codeaurora.org>
parent e68546c8
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -302,10 +302,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
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1258,7 +1258,9 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
	sde_kms_info_add_keyint(info, "max_horizontal_deci", maxhdeciexp);
	sde_kms_info_add_keyint(info, "max_vertical_deci", maxvdeciexp);
	msm_property_set_blob(&psde->property_info, &psde->blob_info,
			info->data, info->len, PLANE_PROP_INFO);
			SDE_KMS_INFO_DATA(info),
			SDE_KMS_INFO_DATALEN(info),
			PLANE_PROP_INFO);

	kfree(info);
}