diff mbox series

[v1,1/1] ACPI: NFIT: Import GUID before use

Message ID 20211213204632.56735-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit abc14eb1e01286819a671019e78a23542685eee2
Headers show
Series [v1,1/1] ACPI: NFIT: Import GUID before use | expand

Commit Message

Andy Shevchenko Dec. 13, 2021, 8:46 p.m. UTC
Strictly speaking the comparison between guid_t and raw buffer
is not correct. Import GUID to variable of guid_t type and then
compare.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/nfit/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Dec. 17, 2021, 6:08 p.m. UTC | #1
On Mon, Dec 13, 2021 at 9:46 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Strictly speaking the comparison between guid_t and raw buffer
> is not correct. Import GUID to variable of guid_t type and then
> compare.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
>  drivers/acpi/nfit/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 7dd80acf92c7..e5d7f2bda13f 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -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
>
Dan Williams Dec. 17, 2021, 6:37 p.m. UTC | #2
On Fri, Dec 17, 2021 at 10:10 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Mon, Dec 13, 2021 at 9:46 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > Strictly speaking the comparison between guid_t and raw buffer
> > is not correct. Import GUID to variable of guid_t type and then
> > compare.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> 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.
diff mbox series

Patch

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 7dd80acf92c7..e5d7f2bda13f 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -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;
 }