Skip to contentSkip to conversation

ACPI: NFIT: Import GUID before use

PATCH In review Andy Shevchenko 3 participants 3 messages Dec 13, 2021 – Dec 17, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: NFIT: Import GUID before use

Strictly speaking the comparison between guid_t and raw buffer is not correct. Import GUID to variable of guid_t type and then compare.

---
 drivers/acpi/nfit/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/nfit/core.c +3 -1
index 7dd80acf92c7..e5d7f2bda13f 100644
@@ -678,10 +678,12 @@ static const char *spa_type_name(u16 type)
 
 int nfit_spa_type(struct acpi_nfit_system_address *spa)
 {
+	guid_t guid;
 	int i;
 
+	import_guid(&guid, spa->range_guid);
 	for (i = 0; i < NFIT_UUID_MAX; i++)
-		if (guid_equal(to_nfit_uuid(i), (guid_t *)&spa->range_guid))
+		if (guid_equal(to_nfit_uuid(i), &guid))
 			return i;
 	return -1;
 }
Signature · 1 line
2.33.0
#1 lore raw
Quoted 6 lines · Andy Shevchenko

Strictly speaking the comparison between guid_t and raw buffer is not correct. Import GUID to variable of guid_t type and then compare.

Dan, are you going to take care of this or should I?

Quoted 25 lines
---
 drivers/acpi/nfit/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/nfit/core.c +3 -2
index 7dd80acf92c7..e5d7f2bda13f 100644
@@ -678,10 +678,12 @@ static const char *spa_type_name(u16 type)
 
 int nfit_spa_type(struct acpi_nfit_system_address *spa)
 {
+       guid_t guid;
        int i;
 
+       import_guid(&guid, spa->range_guid);
        for (i = 0; i < NFIT_UUID_MAX; i++)
-               if (guid_equal(to_nfit_uuid(i), (guid_t *)&spa->range_guid))
+               if (guid_equal(to_nfit_uuid(i), &guid))
                        return i;
        return -1;
 }
--

2.33.0

#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 6 lines · Andy Shevchenko

Strictly speaking the comparison between guid_t and raw buffer is not correct. Import GUID to variable of guid_t type and then compare.

Dan, are you going to take care of this or should I?

I'll take it.

Apologies for the delay in responding. I am still catching up on some patch merging backlog.