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: <20231009131808.lzri7z2nvcmkfuu3@CAB-WSD-L081021>
Date:   Mon, 9 Oct 2023 16:18:08 +0300
From:   Dmitry Rokosov <ddrokosov@...utedevices.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     <lee@...nel.org>, <pavel@....cz>, <robh+dt@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
        <kernel@...rdevices.ru>, <rockosov@...il.com>,
        <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-leds@...r.kernel.org>,
        George Stark <gnstark@...utedevices.com>
Subject: Re: [PATCH v1 09/11] leds: aw200xx: improve autodim calculation
 method

On Fri, Oct 06, 2023 at 09:03:47PM +0300, Andy Shevchenko wrote:
> On Fri, Oct 6, 2023 at 7:05 PM Dmitry Rokosov
> <ddrokosov@...utedevices.com> wrote:
> >
> > From: George Stark <gnstark@...utedevices.com>
> >
> > use DIV_ROUND_UP instead of coarse div
> 
> Please, respect English grammar and punctuation.
> Refer to macros and functions as func() (note the parentheses).
> 
> ...
> 
> >  #define AW200XX_REG_DIM2FADE(x) ((x) + 1)
> > +#define AW200XX_REG_FADE2DIM(fade) \
> > +       DIV_ROUND_UP((fade) * AW200XX_DIM_MAX, AW200XX_FADE_MAX)
> 
> Have you checked if the overflow is _now_ possible (compiling on
> 32-bit platforms as well)?

I suppose we shouldn't carry on about overflow here because the value of
fade cannot exceed 255, and DIM_MAX is set at 63

You can find maximum values of fade and dim in the aw200xx driver
header:

#define AW200XX_DIM_MAX                  (BIT(6) - 1)
#define AW200XX_FADE_MAX                 (BIT(8) - 1)

-- 
Thank you,
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ