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-next>] [day] [month] [year] [list]
Message-Id: <20181129020611.8436-1-wen.yang99@zte.com.cn>
Date:   Thu, 29 Nov 2018 10:06:11 +0800
From:   Wen Yang <wen.yang99@....com.cn>
To:     olivier.moysan@...com, arnaud.pouliquen@...com, broonie@...nel.org,
        tiwai@...e.com, mcoquelin.stm32@...il.com
Cc:     linux-kernel@...r.kernel.org, zhong.weidong@....com.cn,
        Wen Yang <wen.yang99@....com.cn>,
        Liam Girdwood <lgirdwood@...il.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Julia Lawall <julia.lawall@...6.fr>,
        Wen Yang <yellowriver2010@...mail.com>,
        linux-stm32@...md-mailman.stormreply.com
Subject: [PATCH] ASoC: stm32: sai: Fix unsigned comparison with less than zero

The return from the call to stm32_sai_get_clk_div can be a negative error
code however this is being assigned to an unsigned variable 'div'
hence the check is always false. Fix this by making 'div' an
int.

Detected by Coccinelle ("Unsigned expression compared with zero:stages
< 0")

Signed-off-by: Wen Yang <wen.yang99@....com.cn>
CC: Mark Brown <broonie@...nel.org>
CC: Olivier Moysan <olivier.moysan@...com>
CC: Arnaud Pouliquen <arnaud.pouliquen@...com>
CC: Liam Girdwood <lgirdwood@...il.com>
CC: Jaroslav Kysela <perex@...ex.cz>
CC: Takashi Iwai <tiwai@...e.com>
CC: Maxime Coquelin <mcoquelin.stm32@...il.com>
CC: Alexandre Torgue <alexandre.torgue@...com>
CC: Julia Lawall <julia.lawall@...6.fr>
CC: Wen Yang <yellowriver2010@...mail.com>
CC: linux-stm32@...md-mailman.stormreply.com
CC: linux-kernel@...r.kernel.org
---
 sound/soc/stm/stm32_sai_sub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 211589b0b2ef..6e9fff0f9ed7 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -336,7 +336,7 @@ static int stm32_sai_mclk_set_rate(struct clk_hw *hw, unsigned long rate,
 {
 	struct stm32_sai_mclk_data *mclk = to_mclk_data(hw);
 	struct stm32_sai_sub_data *sai = mclk->sai_data;
-	unsigned int div;
+	int div;
 	int ret;
 
 	div = stm32_sai_get_clk_div(sai, parent_rate, rate);
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ