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: <20170207081025.9671-2-andi.shyti@samsung.com>
Date:   Tue, 07 Feb 2017 17:10:25 +0900
From:   Andi Shyti <andi.shyti@...sung.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>,
        Mark Brown <broonie@...nel.org>
Cc:     Javier Martinez Canillas <javier@....samsung.com>,
        linux-samsung-soc@...r.kernel.org, linux-spi@...r.kernel.org,
        linux-kernel@...r.kernel.org, Andi Shyti <andi.shyti@...sung.com>,
        Andi Shyti <andi@...zian.org>
Subject: [PATCH 2/2] spi: s3c64xx: fix potential division by zero

Even though it's quite unlikely to happen in this particular
case, clk_get_rate can return '0' if sdd->src_clk is not set
properly. In that case we would have a clear division by '0'.

Check the return value of clk_get_rate and fail in case it
returns '0'.

This patch fixes '1397922 Division or modulo by zero' from
scan.coverity.com

Signed-off-by: Andi Shyti <andi.shyti@...sung.com>
---
 drivers/spi/spi-s3c64xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index f6ea9ae047ec..a2ec07f44e33 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -811,6 +811,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 
 		/* Max possible */
 		speed = clk_get_rate(sdd->src_clk) / 2 / (0 + 1);
+		if (!speed)
+			goto setup_exit;
 
 		if (spi->max_speed_hz > speed)
 			spi->max_speed_hz = speed;
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ