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] [day] [month] [year] [list]
Message-ID: <CAHp75VfF-y6GSrFKMx75b756jiO+0KtJUpa2X=778XVvoTh5dg@mail.gmail.com>
Date:   Sat, 9 May 2020 14:22:00 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Raul E Rangel <rrangel@...omium.org>
Cc:     Joerg Roedel <jroedel@...e.de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        iommu@...ts.linux-foundation.org,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Daniel Kurtz <djkurtz@...omium.org>,
        Douglas Anderson <dianders@...omium.org>,
        Evan Green <evgreen@...omium.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Jerry Snitselaar <jsnitsel@...hat.com>,
        Joerg Roedel <joro@...tes.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iommu/amd: Fix get_acpihid_device_id

On Sat, May 9, 2020 at 1:50 AM Raul E Rangel <rrangel@...omium.org> wrote:
>
> acpi_dev_hid_uid_match expects a null pointer for UID if it doesn't

acpi_dev_hid_uid_match()

> exist. The acpihid_map_entry contains a char buffer for holding the
> UID. If no UID was provided in the IVRS table, this buffer will be
> zeroed. If we pass in a null string, acpi_dev_hid_uid_match will return

acpi_dev_hid_uid_match()

> false because it will try and match an empty string to the ACPI UID of
> the device.

Thank you for testing and producing a patch! My comments below, after addressing

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

>
> Fixes: ae5e6c6439c3 ("iommu/amd: Switch to use acpi_dev_hid_uid_match()")

Suggested-by?

> Signed-off-by: Raul E Rangel <rrangel@...omium.org>



> ---
>
>  drivers/iommu/amd_iommu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 20cce366e951..06f603366cb1 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -125,7 +125,8 @@ static inline int get_acpihid_device_id(struct device *dev,
>                 return -ENODEV;
>
>         list_for_each_entry(p, &acpihid_map, list) {
> -               if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
> +               if (acpi_dev_hid_uid_match(adev, p->hid,
> +                                          p->uid[0] ? p->uid : NULL)) {

I would still use *p->uid as done in other places in the driver and
put this all on one line (however, the latter is complete style
preference depending on maintainer's choice)

>                         if (entry)
>                                 *entry = p;
>                         return p->devid;
> --
> 2.26.2.645.ge9eca65c58-goog
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ