Skip to contentSkip to conversation

ACPI: fix vendor-defined resource infinite loops

PATCH New Bjorn Helgaas 1 participant 1 message Oct 26, 2005 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: fix vendor-defined resource infinite loops

Loop index type not large enough to represent loop termination value ==> badness. I've tripped over the first infinite loop and verified that this patch fixes it. The second problem was found by inspection.

drivers/acpi/resources/rsmisc.c +3 -5
Index: work4/drivers/acpi/resources/rsmisc.c
===================================================================
@@ -168,9 +168,8 @@
 {
 	u8 *buffer = byte_stream_buffer;
 	struct acpi_resource *output_struct = (void *)*output_buffer;
-	u16 temp16 = 0;
+	u16 temp16 = 0, index;
 	u8 temp8 = 0;
-	u8 index;
 	acpi_size struct_size =
 	    ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
 
@@ -256,9 +255,8 @@
 		      u8 ** output_buffer, acpi_size * bytes_consumed)
 {
 	u8 *buffer = *output_buffer;
-	u16 temp16 = 0;
+	u16 temp16 = 0, index;
 	u8 temp8 = 0;
-	u8 index;
 
 	ACPI_FUNCTION_TRACE("rs_vendor_stream");
 
@@ -286,7 +284,7 @@
 
 	/* Loop through all of the Vendor Specific fields */
 
-	for (index = 0; index < linked_list->data.vendor_specific.length;
+	for (index = 0; index < (u16) linked_list->data.vendor_specific.length;
 	     index++) {
 		temp8 = linked_list->data.vendor_specific.reserved[index];
 

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information