ACK: [PATCH 9/9] lib: fwts_acpi_tables: check table to avoid dereferencing NULL ptr
Alex Hung
alex.hung at canonical.com
Wed Dec 16 03:50:18 UTC 2015
On 2015-12-16 08:51 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Static analysis from clang scan-build detected a potential NULL
> pointer deference on table; fwts_acpi_get_table() can potentially
> return NULL, so check for this corner case.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_acpi_tables.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 86b53a2..da3c450 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -1004,7 +1004,7 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>
> for (i=0,j=0; j<count ;i++)
> if (fwts_acpi_get_table(fw, i, &table) == FWTS_OK)
> - if (fwts_acpi_table_fixable(table))
> + if (table && fwts_acpi_table_fixable(table))
> rsdt->entries[j++] = (uint32_t)table->addr;
>
> strncpy(rsdt->header.signature, "RSDT", 4);
> @@ -1041,7 +1041,7 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw)
>
> for (i=0,j=0; j<count ;i++)
> if (fwts_acpi_get_table(fw, i, &table) == FWTS_OK)
> - if (fwts_acpi_table_fixable(table))
> + if (table && fwts_acpi_table_fixable(table))
> xsdt->entries[j++] = table->addr;
>
> strncpy(xsdt->header.signature, "XSDT", 4);
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list