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]
Date:   Wed, 25 Oct 2023 21:21:12 +0300
From:   Raag Jadav <raag.jadav@...el.com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Mika Westerberg <mika.westerberg@...ux.intel.com>,
        len.brown@...el.com, andriy.shevchenko@...ux.intel.com,
        linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        mallikarjunappa.sangannavar@...el.com, bala.senthil@...el.com
Subject: Re: [PATCH v1] ACPI: LPSS: use acpi_dev_uid_match() for matching _UID

On Wed, Oct 25, 2023 at 08:04:44PM +0200, Rafael J. Wysocki wrote:
> On Wed, Oct 25, 2023 at 7:53 AM Mika Westerberg
> <mika.westerberg@...ux.intel.com> wrote:
> >
> > On Wed, Oct 25, 2023 at 11:08:33AM +0530, Raag Jadav wrote:
> > > Use acpi_dev_uid_match() for matching _UID instead of treating it
> > > as an integer.
> > >
> > > Signed-off-by: Raag Jadav <raag.jadav@...el.com>
> >
> > Acked-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> 
> I was about to apply this, but then I realized that it might change
> the behavior in a subtle way, because what if the _UID string is
> something like "01"?

I checked the git history and found below.

commit 2a036e489eb1571810126d6fa47bd8af1e237c08
Author: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Date:   Tue Sep 13 19:31:41 2022 +0300

    ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()

    ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
    an integer. Use it instead of custom approach.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@...hat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index c4d4d21391d7..4d415e210c32 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -167,10 +167,10 @@ static struct pwm_lookup byt_pwm_lookup[] = {

 static void byt_pwm_setup(struct lpss_private_data *pdata)
 {
-       struct acpi_device *adev = pdata->adev;
+       u64 uid;

        /* Only call pwm_add_table for the first PWM controller */
-       if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
+       if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
                return;

        pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));

So if we consider the original logic with strcmp, which is more inline
with acpi_dev_uid_match(), "01" should not be the case here in my opinion.

Thanks for sharing your concern though.

Raag

Powered by blists - more mailing lists