fwts-devel post from james.puthukattukaran at oracle.com requires approval

Alex Hung alex.hung at canonical.com
Wed Apr 28 20:33:47 UTC 2021


Hi James,

Thanks for the work, but the patch won't apply on the latest repo or on
V21.03.00. Please rebase the patch to the latest version.

Please also be sure to use "git send-email" to send your patch.

Date: Thu, 22 Apr 2021 19:00:27 +0000
> Subject: [PATCH] dmi: dmicheck: return from dmi_table_smbios*() functions
> if signature test fails
> If the dmi_table_smbios*() functions don't match the signature for the
> paticular
> table, then return.
>

Please describe the problem you are trying to fix.



>
> Signed-off-by: James Puthukattukaran <james.puthukattukaran at oracle.com>
> ---
>  src/dmi/dmicheck/dmicheck.c | 46
> +++++++++++++++++++++++++++------------------
>  1 file changed, 28 insertions(+), 18 deletions(-)
>
> diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c
> index a240365..99cb893 100644
> --- a/src/dmi/dmicheck/dmicheck.c
> +++ b/src/dmi/dmicheck/dmicheck.c
> @@ -370,16 +370,19 @@ static void* dmi_table_smbios(fwts_framework *fw,
> fwts_smb
> ios_entry *entry)
>         }
>
>         if (dmi_load_file("/sys/firmware/dmi/tables/smbios_entry_point",
> anchor,
>  4) == FWTS_OK
> -                       && strncmp(anchor, "_SM_", 4) == 0) {
> -               table = malloc(length);
> -               if (!table)
> -                       return NULL;
> -               if (dmi_load_file("/sys/firmware/dmi/tables/DMI", table,
> length)
>  == FWTS_OK) {
> -                       fwts_log_info(fw, "SMBIOS table loaded from
> /sys/firmwar
> e/dmi/tables/DMI");
> -                       return table;
> -               }
> -               free(table);
> +                       && strncmp(anchor, "_SM_", 4) != 0)
> +               return NULL;
> +
> +
> +       table = malloc(length);
> +       if (!table)
> +               return NULL;
> +       if (dmi_load_file("/sys/firmware/dmi/tables/DMI", table, length)
> == FWTS
> _OK) {
> +               fwts_log_info(fw, "SMBIOS table loaded from
> /sys/firmware/dmi/ta
> bles/DMI");
> +               return table;
>         }
> +       free(table);
> +
>
>         mem = fwts_mmap(addr, length);
>         if (mem != FWTS_MAP_FAILED) {
> @@ -418,16 +421,19 @@ static void* dmi_table_smbios30(fwts_framework *fw,
> fwts_s
> mbios30_entry *entry)
>         }
>
>         if (dmi_load_file("/sys/firmware/dmi/tables/smbios_entry_point",
> anchor,
>  5) == FWTS_OK
> -                       && strncmp(anchor, "_SM3_", 5) == 0) {
> -               table = malloc(length);
> -               if (!table)
> -                       return NULL;
> -               if
> (dmi_load_file_variable_size("/sys/firmware/dmi/tables/DMI",
> table, &length) == FWTS_OK) {
> -                       fwts_log_info(fw, "SMBIOS30 table loaded from
> /sys/firmw
> are/dmi/tables/DMI");
> -                       return table;
> -               }
> -               free(table);
> +                       && strncmp(anchor, "_SM3_", 5) != 0)
> +               return NULL;
> +
> +
> +       table = malloc(length);
> +       if (!table)
> +               return NULL;
> +       if (dmi_load_file_variable_size("/sys/firmware/dmi/tables/DMI",
> table, &
> length) == FWTS_OK) {
> +               fwts_log_info(fw, "SMBIOS30 table loaded from
> /sys/firmware/dmi/
> tables/DMI");
> +               return table;
>         }
> +       free(table);
> +
>
>         mem = fwts_mmap(addr, length);
>         if (mem != FWTS_MAP_FAILED) {
> @@ -648,6 +654,8 @@ static int smbios_entry_check(fwts_framework *fw)
>                  */
>                 if (dmi_sane(fw, &entry) == FWTS_OK)
>                         fwts_passed(fw, "SMBIOS Table Entry Structure
> Table Addr
> ess and Length looks valid.");
> +               else
> +                       return FWTS_ERROR;
>         }
>
>         return FWTS_OK;
> @@ -769,6 +777,8 @@ static int smbios30_entry_check(fwts_framework *fw)
>                  */
>                 if (dmi_smbios30_sane(fw, &entry) == FWTS_OK)
>                         fwts_passed(fw, "SMBIOS 3.0 Table Entry Structure
> Table
> Address and Length looks valid.");
> +               else
> +                       return FWTS_ERROR;
>         }
>
>         return FWTS_OK;
> --
> 1.8.3.1
>
>
> --
Cheers,
Alex Hung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20210428/46f7703c/attachment.html>


More information about the fwts-devel mailing list