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: <304efdfe-db6e-051e-b61d-e73a8dfa1c53@axentia.se>
Date:   Thu, 18 Nov 2021 10:36:00 +0100
From:   Peter Rosin <peda@...ntia.se>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Evan Green <evgreen@...omium.org>, linux-i2c@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Peter Korsgaard <peter.korsgaard@...co.com>
Subject: Re: [PATCH v1 1/3] i2c: mux: gpio: Replace custom acpi_get_local_address()

Hi!

On 2021-11-15 16:41, Andy Shevchenko wrote:
> Recently ACPI gained the acpi_get_local_address() API which may be used
> instead of home grown i2c_mux_gpio_get_acpi_adr().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/i2c/muxes/i2c-mux-gpio.c | 43 ++------------------------------
>  1 file changed, 2 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
> index bac415a52b78..31e6eb1591bb 100644
> --- a/drivers/i2c/muxes/i2c-mux-gpio.c
> +++ b/drivers/i2c/muxes/i2c-mux-gpio.c
> @@ -49,45 +49,6 @@ static int i2c_mux_gpio_deselect(struct i2c_mux_core *muxc, u32 chan)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_ACPI
> -
> -static int i2c_mux_gpio_get_acpi_adr(struct device *dev,
> -				     struct fwnode_handle *fwdev,
> -				     unsigned int *adr)
> -
> -{
> -	unsigned long long adr64;
> -	acpi_status status;
> -
> -	status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwdev),
> -				       METHOD_NAME__ADR,
> -				       NULL, &adr64);
> -
> -	if (!ACPI_SUCCESS(status)) {
> -		dev_err(dev, "Cannot get address\n");
> -		return -EINVAL;
> -	}
> -
> -	*adr = adr64;
> -	if (*adr != adr64) {
> -		dev_err(dev, "Address out of range\n");
> -		return -ERANGE;
> -	}

In the conversion, I read it as if we lose this overflow check. Why is that
not a problem?

Cheers,
Peter

> -
> -	return 0;
> -}
> -
> -#else
> -
> -static int i2c_mux_gpio_get_acpi_adr(struct device *dev,
> -				     struct fwnode_handle *fwdev,
> -				     unsigned int *adr)
> -{
> -	return -EINVAL;
> -}
> -
> -#endif
> -
>  static int i2c_mux_gpio_probe_fw(struct gpiomux *mux,
>  				 struct platform_device *pdev)
>  {
> @@ -141,9 +102,9 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux,
>  			fwnode_property_read_u32(child, "reg", values + i);
>  
>  		} else if (is_acpi_node(child)) {
> -			rc = i2c_mux_gpio_get_acpi_adr(dev, child, values + i);
> +			rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i);
>  			if (rc)
> -				return rc;
> +				return dev_err_probe(dev, rc, "Cannot get address\n");
>  		}
>  
>  		i++;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ