All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson-VXdhtT5mjnY@public.gmane.org>
To: "Martin J. Bligh" <mbligh-/CzTsIfkJEdBDgjK7y7TUQ@public.gmane.org>
Cc: "Randy.Dunlap" <rddunlap-3NddpPZAyC0@public.gmane.org>,
	Paul Jackson <pj-sJ/iWh9BUns@public.gmane.org>,
	haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
	acpi-devel
	<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: 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-VXdhtT5mjnY@public.gmane.org>

===== 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);





-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285

WARNING: multiple messages have this Message-ID (diff)
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 18:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 20:46 [PATCH] cleanup ACPI numa warnings Alex Williamson
2004-08-05 21:01 ` 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 [this message]
2004-08-20 18:55                     ` 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=1093028151.4993.42.camel@tdi \
    --to=alex.williamson-vxdhtt5mjny@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mbligh-/CzTsIfkJEdBDgjK7y7TUQ@public.gmane.org \
    --cc=pj-sJ/iWh9BUns@public.gmane.org \
    --cc=rddunlap-3NddpPZAyC0@public.gmane.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.