lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9ccb1760c5b525036a33b9528b651b409e727c2.1701906455.git.soyer@irl.hu>
Date:   Thu,  7 Dec 2023 01:04:26 +0100
From:   Gergo Koteles <soyer@....hu>
To:     Shenghao Ding <shenghao-ding@...com>, Kevin Lu <kevin-lu@...com>,
        Baojun Xu <baojun.xu@...com>, Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Cc:     linux-kernel@...r.kernel.org, alsa-devel@...a-project.org,
        Gergo Koteles <soyer@....hu>
Subject: [PATCH 10/16] ASoC: tas2781: check negative indexes

Negative indexes are not valid here.

Signed-off-by: Gergo Koteles <soyer@....hu>
---
 sound/soc/codecs/tas2781-fmwlib.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index 20dc2df034e9..aa5f56f9ad33 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -2198,21 +2198,21 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
 		goto out;
 	}
 
-	if (cfg_no >= tas_fmw->nr_configurations) {
+	if (cfg_no < 0 || cfg_no >= tas_fmw->nr_configurations) {
 		dev_err(tas_priv->dev,
 			"%s: cfg(%d) is not in range of conf %u\n",
 			__func__, cfg_no, tas_fmw->nr_configurations);
 		goto out;
 	}
 
-	if (prm_no >= tas_fmw->nr_programs) {
+	if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) {
 		dev_err(tas_priv->dev,
 			"%s: prm(%d) is not in range of Programs %u\n",
 			__func__, prm_no, tas_fmw->nr_programs);
 		goto out;
 	}
 
-	if (rca_conf_no >= rca->ncfgs || rca_conf_no < 0 ||
+	if (rca_conf_no < 0 || rca_conf_no >= rca->ncfgs ||
 		!cfg_info) {
 		dev_err(tas_priv->dev,
 			"conf_no:%d should be in range from 0 to %u\n",
@@ -2304,7 +2304,7 @@ int tasdevice_prmg_load(void *context, int prm_no)
 		goto out;
 	}
 
-	if (prm_no >= tas_fmw->nr_programs) {
+	if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) {
 		dev_err(tas_priv->dev,
 			"%s: prm(%d) is not in range of Programs %u\n",
 			__func__, prm_no, tas_fmw->nr_programs);
@@ -2349,7 +2349,7 @@ int tasdevice_prmg_calibdata_load(void *context, int prm_no)
 		goto out;
 	}
 
-	if (prm_no >= tas_fmw->nr_programs) {
+	if (prm_no < 0 || prm_no >= tas_fmw->nr_programs) {
 		dev_err(tas_priv->dev,
 			"%s: prm(%d) is not in range of Programs %u\n",
 			__func__, prm_no, tas_fmw->nr_programs);
-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ