[lkml]   [2004]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [ACPI] Re: [PATCH] cleanup ACPI numa warnings

I'm not sure where we stand on this, sorry for the delay. To recap,
the first patch I submitted cleaned up the original functions, but moved
the ugliness up into multi-line macros. People didn't like the macros
and suggested static inlines. However, static inlines don't work for
this application because the debug print needs state setup by the
ACPI_FUNCTION_NAME call. IMHO, it's not worth setting up that state in
the static inline function for this little bit of cleanup.

So, I think we left it at nobody liked the macros and static inlines
don't work. General unhappiness. Below is a patch that doesn't attempt
to cleanup the original code, it just adds the #ifdefs and range
checking w/ no macros. Does this look better? Below is the original
submit comment outlining the goal. Thanks,


The patch below removes these warnings:

CC drivers/acpi/numa.o
drivers/acpi/numa.c: In function `acpi_table_print_srat_entry':
drivers/acpi/numa.c:55: warning: unused variable `p'
drivers/acpi/numa.c:65: warning: unused variable `p'
drivers/acpi/numa.c: In function `acpi_numa_init':
drivers/acpi/numa.c:179: warning: passing arg 2 of
`acpi_table_parse_srat' from incompatible pointer type
drivers/acpi/numa.c:182: warning: passing arg 2 of
`acpi_table_parse_srat' from incompatible pointer type

And propagates the MADT error checking code into the SRAT code.

Signed-off-by: Alex Williamson <>

===== drivers/acpi/numa.c 1.10 vs edited =====
--- 1.10/drivers/acpi/numa.c 2004-02-18 02:19:31 -07:00
+++ edited/drivers/acpi/numa.c 2004-08-10 16:58:37 -06:00
@@ -51,6 +51,7 @@
switch (header->type) {

struct acpi_table_processor_affinity *p =
(struct acpi_table_processor_affinity*) header;
@@ -58,9 +59,11 @@
p->apic_id, p->lsapic_eid, p->proximity_domain,

struct acpi_table_memory_affinity *p =
(struct acpi_table_memory_affinity*) header;
@@ -70,6 +73,7 @@
p->flags.enabled ? "enabled" : "disabled",
p->flags.hot_pluggable ? " hot-pluggable" : ""));

@@ -103,12 +107,14 @@

static int __init
-acpi_parse_processor_affinity (acpi_table_entry_header *header)
+acpi_parse_processor_affinity (acpi_table_entry_header *header, unsigned long size)
struct acpi_table_processor_affinity *processor_affinity;

processor_affinity = (struct acpi_table_processor_affinity*) header;
- if (!processor_affinity)
+ if (!processor_affinity || (unsigned long)processor_affinity +
+ sizeof(*processor_affinity) > size ||
+ header->length != sizeof(*processor_affinity))
return -EINVAL;

@@ -121,12 +127,14 @@

static int __init
-acpi_parse_memory_affinity (acpi_table_entry_header *header)
+acpi_parse_memory_affinity (acpi_table_entry_header *header, unsigned long size)
struct acpi_table_memory_affinity *memory_affinity;

memory_affinity = (struct acpi_table_memory_affinity*) header;
- if (!memory_affinity)
+ if (!memory_affinity || (unsigned long)memory_affinity +
+ sizeof(*memory_affinity) > size ||
+ header->length != sizeof(*memory_affinity))
return -EINVAL;


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:05    [W:0.073 / U:3.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site