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

Commit 5e5348c7 authored by Mohammad Johny Shaik's avatar Mohammad Johny Shaik Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: Add check for both offset and index variable



-The offset and index variable may leads to array out of
boundary exception.
-Added offset and index overflow check.

Change-Id: I1f71ee595944573e85d77d2001f656bd8ba53806
CRs-fixed: 583931
Signed-off-by: default avatarMohammad Johny Shaik <mjshai@codeaurora.org>
parent 00ca6a61
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -152,12 +152,12 @@ static void msm_send_eq_values(int eq_idx);
 * If new back-end is defined, add new back-end DAI ID at the end of enum
 */


#define SRS_TRUMEDIA_INDEX 2
union srs_trumedia_params_u {
	struct srs_trumedia_params srs_params;
	unsigned short int raw_params[1];
};
static union srs_trumedia_params_u msm_srs_trumedia_params[2];
static union srs_trumedia_params_u msm_srs_trumedia_params[SRS_TRUMEDIA_INDEX];
static int srs_port_id = -1;
static bool is_custom_stereo_on; /* set to false by default */

@@ -1273,7 +1273,7 @@ static int msm_routing_set_srs_trumedia_control_(struct snd_kcontrol *kcontrol,
			SRS_PARAM_OFFSET_MASK) >> 16);
	value = (unsigned short)(ucontrol->value.integer.value[0] &
			SRS_PARAM_VALUE_MASK);
	if (offset < max) {
	if ((offset < max) && (index < SRS_TRUMEDIA_INDEX)) {
		msm_srs_trumedia_params[index].raw_params[offset] = value;
		pr_debug("SRS %s: index set... (max %d, requested %d, val %d, paramblockidx %d)",
			__func__, max, offset, value, index);