public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: check boundary in count/setup_resource called by get_current_resources
@ 2007-11-01  8:20 Yinghai Lu
  2007-11-01  8:32 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Yinghai Lu @ 2007-11-01  8:20 UTC (permalink / raw)
  To: Andrew Morton, Greg Kroah-Hartman, Gary Hade, Thomas Gleixner; +Cc: LKML

[PATCH] x86: check boundary in count/setup_resource called by get_current_resources

need to check info->res_num less than PCI_BUS_NUM_RESOURCES, so
info->bus->resource[info->res_num] = res will not beyond of bus resource array
when acpi resutrn too many resource entries.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/arch/x86/pci/acpi.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/acpi.c
+++ linux-2.6/arch/x86/pci/acpi.c
@@ -77,9 +77,13 @@ count_resource(struct acpi_resource *acp
 	struct acpi_resource_address64 addr;
 	acpi_status status;
 
+	if (info->res_num >= PCI_BUS_NUM_RESOURCES)
+		return AE_OK;
+
 	status = resource_to_addr(acpi_res, &addr);
 	if (ACPI_SUCCESS(status))
 		info->res_num++;
+
 	return AE_OK;
 }
 
@@ -93,6 +97,9 @@ setup_resource(struct acpi_resource *acp
 	unsigned long flags;
 	struct resource *root;
 
+	if (info->res_num >= PCI_BUS_NUM_RESOURCES)
+		return AE_OK;
+
 	status = resource_to_addr(acpi_res, &addr);
 	if (!ACPI_SUCCESS(status))
 		return AE_OK;
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-01 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01  8:20 [PATCH] x86: check boundary in count/setup_resource called by get_current_resources Yinghai Lu
2007-11-01  8:32 ` Andrew Morton
2007-11-01 18:06   ` Yinghai Lu
2007-11-01 20:10     ` Gary Hade
2007-11-01 18:45   ` Gary Hade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox