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: <ZsigomgMVH76ACZH@smile.fi.intel.com>
Date: Fri, 23 Aug 2024 17:45:54 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Ye Zhang <ye.zhang@...k-chips.com>
Cc: linus.walleij@...aro.org, brgl@...ev.pl, heiko@...ech.de,
	linux-gpio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org,
	mika.westerberg@...ux.intel.com, tao.huang@...k-chips.com,
	finley.xiao@...k-chips.com, tim.chen@...k-chips.com,
	elaine.zhang@...k-chips.com
Subject: Re: [PATCH v2] gpio: rockchip: avoid division by zero

On Fri, Aug 23, 2024 at 11:43:04AM +0800, Ye Zhang wrote:
> If the clk_get_rate return '0', it will happen division by zero.

At the abstraction level this is good to avoid 0 division and return an error,
but...

>  		freq = clk_get_rate(bank->db_clk);
> +		if (!freq)
> +			return -EINVAL;

...do you this the absence of debounce here is a fatal error?
(Yes, I see it's a fatal when it's bigger than maximum.)

>  		max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
>  		if (debounce > max_debounce)
>  			return -EINVAL;

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ