mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: "Martin J. Bligh" <mbligh@aracnet.com>
Cc: "Randy.Dunlap" <rddunlap@osdl.org>, Paul Jackson <pj@sgi.com>,
	haveblue@us.ibm.com,
	acpi-devel <acpi-devel@lists.sourceforge.net>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [ACPI] Re: [PATCH] cleanup ACPI numa warnings
Date: Fri, 20 Aug 2004 12:55:51 -0600	[thread overview]
Message-ID: <1093028151.4993.42.camel@tdi> (raw)
In-Reply-To: <2550950000.1092019997@[10.10.2.4]>


   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,

	Alex

   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-10 16:58:37 -06:00
@@ -51,6 +51,7 @@
 	switch (header->type) {
 
 	case ACPI_SRAT_PROCESSOR_AFFINITY:
+#ifdef ACPI_DEBUG_OUTPUT
 	{
 		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,
 		       p->flags.enabled?"enabled":"disabled"));
 	}
+#endif
 		break;
 
 	case ACPI_SRAT_MEMORY_AFFINITY:
+#ifdef ACPI_DEBUG_OUTPUT
 	{
 		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" : ""));
 	}
+#endif
 		break;
 
 	default:
@@ -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;
 
 	acpi_table_print_srat_entry(header);
@@ -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;
 
 	acpi_table_print_srat_entry(header);




  reply	other threads:[~2004-08-20 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 20:46 Alex Williamson
2004-08-05 21:01 ` Dave Hansen
2004-08-05 21:25   ` Alex Williamson
2004-08-06  3:35     ` Martin J. Bligh
2004-08-06  3:50       ` [ACPI] " Randy.Dunlap
2004-08-07 17:57         ` Paul Jackson
2004-08-08 21:36           ` Randy.Dunlap
2004-08-09  2:53             ` Martin J. Bligh
2004-08-20 18:55               ` Alex Williamson [this message]
2004-08-20 19:22                 ` Jesse Barnes
2004-08-09  4:19             ` Alex Williamson
2004-08-09  4:52               ` Dave Hansen
2004-08-09  5:10                 ` Alex Williamson
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=1093028151.4993.42.camel@tdi \
    --to=alex.williamson@hp.com \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=pj@sgi.com \
    --cc=rddunlap@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome