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: <CAK8P3a0qUMMMDmbp2FM-7D-U0Ys_zv0paYguFeyifafZurndEw@mail.gmail.com>
Date:   Fri, 20 Mar 2020 18:09:39 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Guru Das Srinagesh <gurus@...eaurora.org>
Cc:     Linux PWM List <linux-pwm@...r.kernel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Subbaraman Narayanamurthy <subbaram@...eaurora.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>
Subject: Re: [PATCH v11 06/12] pwm: imx27: Use 64-bit division macro and function

On Fri, Mar 20, 2020 at 2:42 AM Guru Das Srinagesh <gurus@...eaurora.org> wrote:

> @@ -240,8 +240,7 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>
>         period_cycles /= prescale;
>         c = (unsigned long long)period_cycles * state->duty_cycle;
> -       do_div(c, state->period);
> -       duty_cycles = c;
> +       duty_cycles = div64_u64(c, state->period);
>

This change looks fine, but I wonder if the code directly above it

        c = clk_get_rate(imx->clk_per);
        c *= state->period;
        do_div(c, 1000000000);
        period_cycles = c;

might run into an overflow when both the clock rate and the period
are large numbers.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ