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: <CAHp75Vcr5Owjn0HK-+D0mpPJAkAxG7F8bEO=sqvhT8w=_xnF7w@mail.gmail.com>
Date:   Tue, 13 Jun 2023 20:08:08 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Herve Codina <herve.codina@...tlin.com>
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        alsa-devel@...a-project.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
        Christophe Leroy <christophe.leroy@...roup.eu>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v3 06/12] minmax: Introduce {min,max}_array()

On Tue, Jun 13, 2023 at 11:00 AM Herve Codina <herve.codina@...tlin.com> wrote:
> On Mon, 12 Jun 2023 17:10:40 +0300
> Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> > On Mon, Jun 12, 2023 at 3:30 PM Herve Codina <herve.codina@...tlin.com> wrote:
> > >
> > > Introduce min_array() (resp max_array()) in order to get the
> > > minimal (resp maximum) of values present in an array.
> >
> > Some comments below, after addressing them,
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

...

> > > +       typeof(array) __array = (array);                        \
> >
> > We have __must_be_array()
>
> Using __must_be_array() will lead to some failure.
> Indeed, we can have:
>   --- 8< ---
>   int *buff
>   ...
>   min = min_array(buff, nb_item);
>   --- 8< ---
>
> In this case, __must_be_array() will report that buff is not an array.

Oh, I missed that.

> To avoid any confusion, what do you think if I renamed {min,max}_array()
> to {min,max}_buffer() and replace __array by __buff and use *(__buff + xxx)
> instead of array[xxx] in the macro.

But functionally it's still against an array.

I would stick with "array" in the name, but add a comment why
__must_be_array() is not used. If we need a stricter variant, we may
add a new wrapper with that check. That said, I think we can use
__array[0] and similar indexed accesses.


--
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ