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] [day] [month] [year] [list]
Message-ID: <6f9b0a94-6289-990b-84b3-80d70e17d3e2@broadcom.com>
Date:   Fri, 17 Jul 2020 11:24:40 -0700
From:   Scott Branden <scott.branden@...adcom.com>
To:     Ray Jui <ray.jui@...adcom.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Lee Jones <lee.jones@...aro.org>
Cc:     Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        BCM Kernel Feedback <bcm-kernel-feedback-list@...adcom.com>,
        linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
Subject: Re: [PATCH] pwm: bcm-iproc: handle clk_get_rate() return



On 2020-07-17 10:22 a.m., Ray Jui wrote:
>
> On 7/17/2020 10:07 AM, Scott Branden wrote:
>> From: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
>>
>> Handle clk_get_rate() returning <= 0 condition to avoid
>> possible division by zero.
>>
>> Fixes: daa5abc41c80 ("pwm: Add support for Broadcom iProc PWM controller")
>> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
>> Signed-off-by: Scott Branden <scott.branden@...adcom.com>
>> ---
>>   drivers/pwm/pwm-bcm-iproc.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c
>> index 1f829edd8ee7..72a8607b6c8d 100644
>> --- a/drivers/pwm/pwm-bcm-iproc.c
>> +++ b/drivers/pwm/pwm-bcm-iproc.c
>> @@ -86,6 +86,11 @@ static void iproc_pwmc_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>>   	u32 value, prescale;
>>   
>>   	rate = clk_get_rate(ip->clk);
>> +	if (rate == 0) {
>> +		state->period = 0;
>> +		state->duty_cycle = 0;
>> +		return;
>> +	}
I'll move the logic after the polarity and enabled fields are populated.
> Based on the pwm core code, 'get_state' expects the following fields to
> be populated: 'polarity', 'enabled', 'period', and 'duty cycle'.
>
> The above logic will leave 'polarity' and 'enabled' completely
> unpopulated when clock rate is zero.
>
>>   
>>   	value = readl(ip->base + IPROC_PWM_CTRL_OFFSET);
>>   
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ