tas25xx_algo:add protection for tas25xx_set_profile

- fix StsHostTestCases - android.security.sts.Poc17_06#testPocCVE_2017_7369
- when sts test,  the profile_id is negative value.
  as <3>[   61.218757]  tas25xx_set_profile profile_id=-2147479279,param_id=0
   need to add protection.

Change-Id: Ia8eb4dc7a1a7ae869e3a254ed3cd0fa6b329c04b
Signed-off-by: liaohj <liaohj@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1431155
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wanlong Zhou <zhouwl@motorola.com>
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
liaohj 2019-10-02 14:43:27 +08:00 • committed by Hujun Liao
commit 1929a78679

View file

@ -169,7 +169,7 @@ static int tas25xx_set_profile(struct snd_kcontrol *pKcontrol,
int profile_id = pUcontrol->value.integer.value[0];
int param_id = 0;
int max_number_of_profiles = sizeof(profile_index_text)/sizeof(profile_index_text[0]);
if (profile_id >= max_number_of_profiles)
if ((profile_id >= max_number_of_profiles) || (profile_id < 0))
return -EINVAL;
pr_info("TI-SmartPA: %s: Setting profile %s", __func__, profile_index_text[profile_id]);