diff mbox series

lib: fwts_smbios: fix loading SMBIOS table from uefi

Message ID 20211022171849.2090452-1-alex.hung@canonical.com
State Accepted
Headers show
Series lib: fwts_smbios: fix loading SMBIOS table from uefi | expand

Commit Message

Alex Hung Oct. 22, 2021, 5:18 p.m. UTC
From: G Edhaya Chandran <edhaya.chandran@arm.com>

Buglink: https://bugs.launchpad.net/bugs/1947956

In the case where SMBIOS table is loaded from
/sys/firmware/dmi/tables/smbios_entry_point,
the load fails due to a logical error in the if condition which is
solved below:

The load fails with the below logs
dmicheck: Could not find any SMBIOS Table Entry Points.
dmicheck: Cannot find SMBIOS30 table entry.

Fixes: 8ce006f4ada ("lib: fwts_smbios: merge similar functions")
Signed-off-by: Edhaya Chandran <edhaya.chandran@arm.com>
Signed-off-by: Alex Hung <alex.hung@canonical.com
---
 src/lib/src/fwts_smbios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ivan Hu Oct. 25, 2021, 3:30 a.m. UTC | #1
On 10/23/21 1:18 AM, Alex Hung wrote:
> From: G Edhaya Chandran <edhaya.chandran@arm.com>
> 
> Buglink: https://bugs.launchpad.net/bugs/1947956
> 
> In the case where SMBIOS table is loaded from
> /sys/firmware/dmi/tables/smbios_entry_point,
> the load fails due to a logical error in the if condition which is
> solved below:
> 
> The load fails with the below logs
> dmicheck: Could not find any SMBIOS Table Entry Points.
> dmicheck: Cannot find SMBIOS30 table entry.
> 
> Fixes: 8ce006f4ada ("lib: fwts_smbios: merge similar functions")
> Signed-off-by: Edhaya Chandran <edhaya.chandran@arm.com>
> Signed-off-by: Alex Hung <alex.hung@canonical.com
> ---
>  src/lib/src/fwts_smbios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_smbios.c b/src/lib/src/fwts_smbios.c
> index 8da572e9..6402fad8 100644
> --- a/src/lib/src/fwts_smbios.c
> +++ b/src/lib/src/fwts_smbios.c
> @@ -91,7 +91,7 @@ static void *fwts_smbios_find_entry_uefi(
>  		}
>  
>  		if (fwts_load_file("/sys/firmware/dmi/tables/smbios_entry_point", entry, size) == FWTS_OK &&
> -		    strncmp((char*)entry, sm, strlen(sm))) {
> +		    !strncmp((char*)entry, sm, strlen(sm))) {
>  			fwts_log_info(fw, "%s entry loaded from /sys/firmware/dmi/tables/smbios_entry_point\n", smbios);
>  			*type  = FWTS_SMBIOS;
>  			return addr;
> 


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Sunny Wang Oct. 27, 2021, 2:44 p.m. UTC | #2
Looks good. Tested on an ARM based server system. Thanks to Edhaya and Alex. 😊

Reviewed-by: Sunny Wang <sunny.wang@arm.com>
Tested-by: Sunny Wang <sunny.wang@arm.com>

-----Original Message-----
From: fwts-devel <fwts-devel-bounces@lists.ubuntu.com> On Behalf Of Alex Hung
Sent: 22 October 2021 18:19
To: fwts-devel@lists.ubuntu.com
Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
Subject: [PATCH] lib: fwts_smbios: fix loading SMBIOS table from uefi

From: G Edhaya Chandran <edhaya.chandran@arm.com>

Buglink: https://bugs.launchpad.net/bugs/1947956

In the case where SMBIOS table is loaded from
/sys/firmware/dmi/tables/smbios_entry_point,
the load fails due to a logical error in the if condition which is
solved below:

The load fails with the below logs
dmicheck: Could not find any SMBIOS Table Entry Points.
dmicheck: Cannot find SMBIOS30 table entry.

Fixes: 8ce006f4ada ("lib: fwts_smbios: merge similar functions")
Signed-off-by: Edhaya Chandran <edhaya.chandran@arm.com>
Signed-off-by: Alex Hung <alex.hung@canonical.com
---
 src/lib/src/fwts_smbios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_smbios.c b/src/lib/src/fwts_smbios.c
index 8da572e9..6402fad8 100644
--- a/src/lib/src/fwts_smbios.c
+++ b/src/lib/src/fwts_smbios.c
@@ -91,7 +91,7 @@ static void *fwts_smbios_find_entry_uefi(
                }

                if (fwts_load_file("/sys/firmware/dmi/tables/smbios_entry_point", entry, size) == FWTS_OK &&
-                   strncmp((char*)entry, sm, strlen(sm))) {
+                   !strncmp((char*)entry, sm, strlen(sm))) {
                        fwts_log_info(fw, "%s entry loaded from /sys/firmware/dmi/tables/smbios_entry_point\n", smbios);
                        *type  = FWTS_SMBIOS;
                        return addr;
--
2.33.1


--
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
diff mbox series

Patch

diff --git a/src/lib/src/fwts_smbios.c b/src/lib/src/fwts_smbios.c
index 8da572e9..6402fad8 100644
--- a/src/lib/src/fwts_smbios.c
+++ b/src/lib/src/fwts_smbios.c
@@ -91,7 +91,7 @@  static void *fwts_smbios_find_entry_uefi(
 		}
 
 		if (fwts_load_file("/sys/firmware/dmi/tables/smbios_entry_point", entry, size) == FWTS_OK &&
-		    strncmp((char*)entry, sm, strlen(sm))) {
+		    !strncmp((char*)entry, sm, strlen(sm))) {
 			fwts_log_info(fw, "%s entry loaded from /sys/firmware/dmi/tables/smbios_entry_point\n", smbios);
 			*type  = FWTS_SMBIOS;
 			return addr;