[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87my7z16u5.fsf@basil.nowhere.org>
Date: Tue, 23 Jun 2009 14:18:42 +0200
From: Andi Kleen <andi@...stfloor.org>
To: Len Brown <lenb@...nel.org>
Cc: sfi-devel@...plefirmware.org, linux-kernel@...r.kernel.org,
Feng Tang <feng.tang@...el.com>,
Len Brown <len.brown@...el.com>
Subject: Re: [PATCH 6/8] SFI: add ACPI extensions
Len Brown <lenb@...nel.org> 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@...ux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists