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: <20190902151803.wgt2x5rtpziggtgx@pathway.suse.cz>
Date:   Mon, 2 Sep 2019 17:18:03 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     rafael@...nel.org, linux-kernel@...r.kernel.org,
        Rob Herring <robh@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        devicetree@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v4 08/11] lib/vsprintf: Make use of fwnode API to obtain
 node names and separators

On Mon 2019-09-02 11:32:37, Sakari Ailus wrote:
> Instead of implementing our own means of discovering parent nodes, node
> names or counting how many parents a node has, use the newly added
> functions in the fwnode API to obtain that information.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  lib/vsprintf.c | 38 ++++++++++++++++----------------------
>  1 file changed, 16 insertions(+), 22 deletions(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index b00b57f9f911f..a04a2167101ef 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1863,32 +1864,24 @@ char *flags_string(char *buf, char *end, void *flags_ptr,
>  	return format_flags(buf, end, flags, names);
>  }
>  
> -static const char *device_node_name_for_depth(const struct device_node *np, int depth)
> -{
> -	for ( ; np && depth; depth--)
> -		np = np->parent;
> -
> -	return kbasename(np->full_name);
> -}
> -
>  static noinline_for_stack
> -char *device_node_gen_full_name(const struct device_node *np, char *buf, char *end)
> +char *fwnode_full_name_string(struct fwnode_handle *fwnode, char *buf,
> +			      char *end)
>  {
>  	int depth;
> -	const struct device_node *parent = np->parent;
>  
> -	/* special case for root node */
> -	if (!parent)
> -		return string_nocheck(buf, end, "/", default_str_spec);
> +	for (depth = fwnode_count_parents(fwnode); depth >= 0; depth--) {

It looked suspicious that it iterated "depth + 1" times. It might be
obvious for people traversing paths every day but not for me ;-)
Please, add a comment, for example:

	/* Iterate over parents and current node. */

With the above comment:

Reviewed-by: Petr Mladek <pmladek@...e.com>

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ