From: Alex Williamson <alex.williamson@hp.com>
To: acpi-devel <acpi-devel@lists.sourceforge.net>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] cleanup ACPI numa warnings
Date: Thu, 05 Aug 2004 14:46:38 -0600 [thread overview]
Message-ID: <1091738798.22406.9.camel@tdi> (raw)
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 <alex.williamson@hp.com>
===== 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-05 14:37:19 -06:00
@@ -38,6 +38,33 @@
extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
+#ifdef ACPI_DEBUG_OUTPUT
+#define acpi_print_srat_processor_affinity(header) { \
+ struct acpi_table_processor_affinity *p = \
+ (struct acpi_table_processor_affinity*) header; \
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] " \
+ "eid[0x%02x]) in proximity domain %d %s\n", \
+ p->apic_id, p->lsapic_eid, p->proximity_domain, \
+ p->flags.enabled?"enabled":"disabled")); }
+
+#define acpi_print_srat_memory_affinity(header) { \
+ struct acpi_table_memory_affinity *p = \
+ (struct acpi_table_memory_affinity*) header; \
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length " \
+ "0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",\
+ p->base_addr_hi, p->base_addr_lo, p->length_hi, \
+ p->length_lo, p->memory_type, p->proximity_domain, \
+ p->flags.enabled ? "enabled" : "disabled", \
+ p->flags.hot_pluggable ? " hot-pluggable" : "")); }
+#else
+#define acpi_print_srat_processor_affinity(header)
+#define acpi_print_srat_memory_affinity(header)
+#endif
+
+#define BAD_SRAT_ENTRY(entry, end) ( \
+ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
+ ((acpi_table_entry_header *)entry)->length != sizeof(*entry))
+
void __init
acpi_table_print_srat_entry (
acpi_table_entry_header *header)
@@ -51,27 +78,11 @@
switch (header->type) {
case ACPI_SRAT_PROCESSOR_AFFINITY:
- {
- struct acpi_table_processor_affinity *p =
- (struct acpi_table_processor_affinity*) header;
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
- p->apic_id, p->lsapic_eid, p->proximity_domain,
- p->flags.enabled?"enabled":"disabled"));
- }
+ acpi_print_srat_processor_affinity(header);
break;
-
case ACPI_SRAT_MEMORY_AFFINITY:
- {
- struct acpi_table_memory_affinity *p =
- (struct acpi_table_memory_affinity*) header;
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
- p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
- p->memory_type, p->proximity_domain,
- p->flags.enabled ? "enabled" : "disabled",
- p->flags.hot_pluggable ? " hot-pluggable" : ""));
- }
+ acpi_print_srat_memory_affinity(header);
break;
-
default:
printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
header->type);
@@ -103,12 +114,12 @@
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 (BAD_SRAT_ENTRY(processor_affinity, size))
return -EINVAL;
acpi_table_print_srat_entry(header);
@@ -121,12 +132,12 @@
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 (BAD_SRAT_ENTRY(memory_affinity, size))
return -EINVAL;
acpi_table_print_srat_entry(header);
next reply other threads:[~2004-08-05 20:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-05 20:46 Alex Williamson [this message]
2004-08-05 21:01 ` [PATCH] cleanup ACPI numa warnings Dave Hansen
2004-08-05 21:01 ` Dave Hansen
2004-08-05 21:25 ` Alex Williamson
2004-08-05 21:25 ` Alex Williamson
2004-08-06 3:35 ` Martin J. Bligh
2004-08-06 3:50 ` [ACPI] " Randy.Dunlap
[not found] ` <20040805205059.3fb67b71.rddunlap-3NddpPZAyC0@public.gmane.org>
2004-08-07 17:57 ` Paul Jackson
2004-08-07 17:57 ` [ACPI] " Paul Jackson
2004-08-08 21:36 ` Randy.Dunlap
[not found] ` <20040808143631.7c18cae9.rddunlap-3NddpPZAyC0@public.gmane.org>
2004-08-09 2:53 ` Martin J. Bligh
2004-08-09 2:53 ` [ACPI] " Martin J. Bligh
2004-08-20 18:55 ` Alex Williamson
2004-08-20 18:55 ` [ACPI] " Alex Williamson
2004-08-20 19:22 ` Jesse Barnes
2004-08-09 4:19 ` Alex Williamson
[not found] ` <1092025184.2292.26.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2004-08-09 4:52 ` Dave Hansen
2004-08-09 4:52 ` Dave Hansen
2004-08-09 5:10 ` Alex Williamson
[not found] ` <1092028238.2211.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2004-08-09 5:44 ` Dave Hansen
2004-08-09 5:44 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1091738798.22406.9.camel@tdi \
--to=alex.williamson@hp.com \
--cc=acpi-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.