[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YhkKc2fa8dSTA9pc@zx2c4.com>
Date: Fri, 25 Feb 2022 17:57:23 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Alexander Graf <graf@...zon.com>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Len Brown <lenb@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Greg KH <gregkh@...uxfoundation.org>, ardb@...nel.org,
dwmw@...zon.co.uk
Subject: Re: [PATCH] ACPI: bus: Match first 9 bytes of device IDs
Hi Alex,
Thanks for this.
I tested this out with the vmgenid driver, and I found a bug in this v1:
On Fri, Feb 25, 2022 at 04:55:52PM +0100, Alexander Graf wrote:
> - if (id->id[0] && !strcmp((char *)id->id, hwid->id))
> + if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN))
This only worked once I made that `ACPI_ID_LEN - 1`, because that length
includes the null terminator. The below patch works fine. If you adjust
that and send a quick v2 follow-up, I'm happy to ack it.
Regards,
Jason
--------8<--------------------------
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 07f604832fd6..f179ebf16f21 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -829,7 +829,7 @@ static bool __acpi_match_device(struct acpi_device *device,
/* First, check the ACPI/PNP IDs provided by the caller. */
if (acpi_ids) {
for (id = acpi_ids; id->id[0] || id->cls; id++) {
- if (id->id[0] && !strcmp((char *)id->id, hwid->id))
+ if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN - 1))
goto out_acpi_match;
if (id->cls && __acpi_match_device_cls(id, hwid))
goto out_acpi_match;
diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index b503c210c2d7..04751fc1d365 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -78,8 +78,7 @@ static void vmgenid_acpi_notify(struct acpi_device *device, u32 event)
}
static const struct acpi_device_id vmgenid_ids[] = {
- { "QEMUVGID", 0 }, /* QEMU */
- { "VMGENID", 0 }, /* Firecracker */
+ { "VM_GEN_C", 0 }, /* Truncated "VM_Gen_Counter" */
{ },
};
Powered by blists - more mailing lists