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: <20220831120027.000017b3@huawei.com>
Date:   Wed, 31 Aug 2022 12:00:27 +0100
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Robert Richter <rrichter@....com>
CC:     Alison Schofield <alison.schofield@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Ira Weiny <ira.weiny@...el.com>,
        Ben Widawsky <bwidawsk@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>
Subject: Re: [PATCH 09/15] cxl/acpi: Determine PCI host bridge's ACPI UID

On Wed, 31 Aug 2022 10:15:57 +0200
Robert Richter <rrichter@....com> wrote:

> The UID is needed to read the RCH's CEDT entry with the RCRB base
> address. Determine the host's UID from its ACPI fw node.
> 
> Signed-off-by: Robert Richter <rrichter@....com>
> ---
>  drivers/cxl/acpi.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index f9cdf23a91a8..b3146b7ae922 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -368,8 +368,20 @@ struct pci_host_bridge *cxl_find_next_rch(struct pci_host_bridge *host)
>  static int __init cxl_restricted_host_probe(struct platform_device *pdev)
>  {
>  	struct pci_host_bridge *host = NULL;
> +	struct acpi_device *adev;
> +	unsigned long long uid = ~0;
>  
>  	while ((host = cxl_find_next_rch(host)) != NULL) {
> +		adev = ACPI_COMPANION(&host->dev);
> +		if (!adev || !adev->pnp.unique_id ||
> +			(kstrtoull(adev->pnp.unique_id, 10, &uid) < 0))

There is an acpi_device_uid() accessor function that should probably be
used here.

Also, should a fialure to convert to an integer (or one within
limits) be something we paper over?  Feels like we should fail
hard if that happens.

Admittedly I can't immediately find any spec that states that
the _UID should be either integer or under 32 bits...
ACPI allows a string and CXL just says it's 4 bytes long.

> +			continue;
> +
> +		dev_dbg(&adev->dev, "host uid: %llu\n", uid);
> +
> +		if (uid > U32_MAX)
> +			continue;
> +
>  		dev_info(&host->dev, "host supports CXL\n");
>  	}
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ