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]
Date:   Thu, 9 May 2019 08:52:53 +0000
From:   "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "sboyd@...nel.org" <sboyd@...nel.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>
CC:     "heiko@...ech.de" <heiko@...ech.de>,
        "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 02/16] treewide: rename match_string() ->
 __match_string()

On Wed, 2019-05-08 at 10:00 -0700, Stephen Boyd wrote:
> [External]
> 
> 
> (Trimming the lists but keeping lkml)
> 
> Quoting Alexandru Ardelean (2019-05-08 04:28:28)
> > This change does a rename of match_string() -> __match_string().
> > 
> > There are a few parts to the intention here (with this change):
> > 1. Align with sysfs_match_string()/__sysfs_match_string()
> > 2. This helps to group users of `match_string()` into simple users:
> >    a. those that use ARRAY_SIZE(_a) to specify the number of elements
> >    b. those that use -1 to pass a NULL terminated array of strings
> >    c. special users, which (after eliminating 1 & 2) are not that many
> > 3. The final intent is to fix match_string()/__match_string() which is
> >    slightly broken, in the sense that passing -1 or a positive value
> > does
> >    not make any difference: the iteration will stop at the first NULL
> >    element.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> > ---
> 
> [...]
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 96053a96fe2f..0b6c3d300411 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -2305,8 +2305,8 @@ bool clk_has_parent(struct clk *clk, struct clk
> > *parent)
> >         if (core->parent == parent_core)
> >                 return true;
> > 
> > -       return match_string(core->parent_names, core->num_parents,
> > -                           parent_core->name) >= 0;
> > +       return __match_string(core->parent_names, core->num_parents,
> > +                             parent_core->name) >= 0;
> 
> This is essentially ARRAY_SIZE(core->parent_names) so it should be fine
> to put this back to match_string() later in the series.

I don't think so.
core->parents & core->parent_names seem to be dynamically allocated array.
ARRAY_SIZE() is a macro that expands at pre-compile time and evaluates
correctly at compile time only for static arrays.


> >  }
> >  EXPORT_SYMBOL_GPL(clk_has_parent);
> > 
> > diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
> > index c3ad92965823..373f13e9cd83 100644
> > --- a/drivers/clk/rockchip/clk.c
> > +++ b/drivers/clk/rockchip/clk.c
> > @@ -276,8 +276,8 @@ static struct clk
> > *rockchip_clk_register_frac_branch(
> >                 struct clk *mux_clk;
> >                 int ret;
> > 
> > -               frac->mux_frac_idx = match_string(child->parent_names,
> > -                                                 child->num_parents,
> > name);
> > +               frac->mux_frac_idx = __match_string(child-
> > >parent_names,
> > +                                                   child->num_parents, 
> > name);
> 
> I suspect this is the same as above, but Heiko can ack/confirm.
> 
> >                 frac->mux_ops = &clk_mux_ops;
> >                 frac->clk_nb.notifier_call =
> > rockchip_clk_frac_notifier_cb;
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ