Re: [PATCH 6/8] SFI: add ACPI extensions

From: Andi Kleen
Date: Tue Jun 23 2009 - 08:19:07 EST


Len Brown <lenb@xxxxxxxxxx> writes:
>
> diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
> index 646d39c..921746f 100644
> --- a/drivers/acpi/tables.c
> +++ b/drivers/acpi/tables.c
> @@ -277,6 +277,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
> struct acpi_table_header *table = NULL;
> acpi_size tbl_size;
>
> + if (acpi_disabled)
> + return 1;
> +

This seems like a weird place to hook this in. Shouldn't that be somewhere else, more
high level?


> +#include <linux/acpi.h>
> +#include <linux/kernel.h>
> +#include <linux/sfi.h>
> +#include "sfi_core.h"
> +
> +#undef PREFIX

Nobody should set PREFIX in headers? If they do better fix the headers.


> + * sfi_acpi_parse_xsdt()
> + *
> + * Parse the ACPI XSDT for later access by sfi_acpi_table_parse().
> + */
> +static int __init sfi_acpi_parse_xsdt(struct sfi_table_header *table)
> +{
> + int num_entries, i;
> +
> + struct acpi_table_xsdt *xsdt = (struct acpi_table_xsdt *) table;
> +
> + BUG_ON(!xsdt);


Seems like a pointless BUG_ON, the NULL pointer reference next to it is
obvious enough.

> +
> + num_entries = (xsdt->header.length - sizeof(struct acpi_table_header) /
> + sizeof(u64));
> +
> + pr_debug(PREFIX "XSDT has %d entries\n", num_entries);
> +
> + for (i = 0; i < num_entries; i++)
> + sfi_tb_install_table(xsdt->table_offset_entry[i], SFI_ACPI_TABLE);

Shouldn't this have some more sanity checking, e.g. for overflows?


-Andi
--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/