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: <nycvar.YSQ.7.76.1710031443230.5407@knanqh.ubzr>
Date:   Tue, 3 Oct 2017 14:43:53 -0400 (EDT)
From:   Nicolas Pitre <nicolas.pitre@...aro.org>
To:     Rob Herring <robh@...nel.org>
cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        Frank Rowand <frowand.list@...il.com>
Subject: Re: [PATCH 1/2] of/fdt: add of_fdt_device_is_available function

On Tue, 3 Oct 2017, Rob Herring wrote:

> Add an equivalent function to of_device_is_available for flattened DT, and
> convert the one existing open coded occurrence.
> 
> Cc: Nicolas Pitre <nicolas.pitre@...aro.org>
> Cc: Frank Rowand <frowand.list@...il.com>
> Signed-off-by: Rob Herring <robh@...nel.org>

Tested-by: Nicolas Pitre <nico@...aro.org>


> ---
>  drivers/of/fdt.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 27c535af0be8..f8c39705418b 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -132,6 +132,19 @@ bool of_fdt_is_big_endian(const void *blob, unsigned long node)
>  	return false;
>  }
>  
> +static bool of_fdt_device_is_available(const void *blob, unsigned long node)
> +{
> +	const char *status = fdt_getprop(blob, node, "status", NULL);
> +
> +	if (!status)
> +		return true;
> +
> +	if (!strcmp(status, "ok") || !strcmp(status, "okay"))
> +		return true;
> +
> +	return false;
> +}
> +
>  /**
>   * of_fdt_match - Return true if node matches a list of compatible values
>   */
> @@ -605,7 +618,6 @@ static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname,
>  					  int depth, void *data)
>  {
>  	static int found;
> -	const char *status;
>  	int err;
>  
>  	if (!found && depth == 1 && strcmp(uname, "reserved-memory") == 0) {
> @@ -625,8 +637,7 @@ static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname,
>  		return 1;
>  	}
>  
> -	status = of_get_flat_dt_prop(node, "status", NULL);
> -	if (status && strcmp(status, "okay") != 0 && strcmp(status, "ok") != 0)
> +	if (!of_fdt_device_is_available(initial_boot_params, node))
>  		return 0;
>  
>  	err = __reserved_mem_reserve_reg(node, uname);
> -- 
> 2.11.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ