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>] [day] [month] [year] [list]
Message-ID: <20241106140603.14516-2-v.shevtsov@maxima.ru>
Date: Wed, 6 Nov 2024 14:06:02 +0000
From: Vitaliy Shevtsov <v.shevtsov@...ima.ru>
To: Cezary Rojewski <cezary.rojewski@...el.com>
CC: Vitaliy Shevtsov <v.shevtsov@...ima.ru>, Liam Girdwood
	<liam.r.girdwood@...ux.intel.com>, Peter Ujfalusi
	<peter.ujfalusi@...ux.intel.com>, Bard Liao
	<yung-chuan.liao@...ux.intel.com>, Ranjani Sridharan
	<ranjani.sridharan@...ux.intel.com>, Kai Vehmanen
	<kai.vehmanen@...ux.intel.com>, Pierre-Louis Bossart
	<pierre-louis.bossart@...ux.dev>, Mark Brown <broonie@...nel.org>, Jaroslav
 Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	<linux-sound@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<lvc-project@...uxtesting.org>
Subject: [PATCH] ASoC: Intel: sof_wm8804: add check for CLKDIV setting

Currently the return value of snd_soc_dai_set_clkdiv() is not checked for a
possible failure. Despite it cannot fail as long as the second argument is
either WM8804_CLKOUT_DIV or WM8804_MCLK_DIV because wm8804_set_clkdiv() handles
both of them it is still better to add this check for the sake of completeness
and correctness. Also this is the only snd_soc_dai_set_clkdiv() call site where
the return value is not processed.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Vitaliy Shevtsov <v.shevtsov@...ima.ru>
---
 sound/soc/intel/boards/sof_wm8804.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/sof_wm8804.c b/sound/soc/intel/boards/sof_wm8804.c
index facc6c32cbfe..d7ac54e9d0a8 100644
--- a/sound/soc/intel/boards/sof_wm8804.c
+++ b/sound/soc/intel/boards/sof_wm8804.c
@@ -123,7 +123,12 @@ static int sof_wm8804_hw_params(struct snd_pcm_substream *substream,
 		}
 	}
 
-	snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div);
+	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div);
+	if (ret < 0) {
+		dev_err(rtd->card->dev, "Failed to set WM8804 CLKDIV\n");
+		return ret;
+	}
+
 	ret = snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq);
 	if (ret < 0) {
 		dev_err(rtd->card->dev, "Failed to set WM8804 PLL\n");
-- 
2.46.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ