Skip to contentSkip to conversation

[buggy index field handling] [patch]

PATCH In review Ducrot Bruno 1 participant 4 messages Sep 22, 2003 2 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 [buggy index field handling] [patch]

Hi Andy,

There is a funny bug in acpi/executer/exfldio.c::acpi_ex_field_datum_io

When the field come from an indexed one, we read all the time from the address obj_desc->index_field.value
Unfortunately, this is wrong, since the correct address is obviously &obj_desc->index_field.value + field_datum_byte_offset

drivers/acpi/executer/exfldio.c +1 -1
@@ -425,7 +425,7 @@
 		/* Write the index value to the index_register (itself a region_field) */
 
 		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-				 &obj_desc->index_field.value,
+				 &obj_desc->index_field.value + field_datum_byte_offset,
 				 sizeof (obj_desc->index_field.value));
 		if (ACPI_FAILURE (status)) {
 			return_ACPI_STATUS (status);

Cheers,

Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Ducrot Bruno

Hi Andy,

There is a funny bug in acpi/executer/exfldio.c::acpi_ex_field_datum_io

When the field come from an indexed one, we read all the time from the address obj_desc->index_field.value
Unfortunately, this is wrong, since the correct address is obviously &obj_desc->index_field.value + field_datum_byte_offset

Oh my, that patch is wrong indeed. Will give you an updated one.

Quoted 25 lines
drivers/acpi/executer/exfldio.c +1 -1
@@ -425,7 +425,7 @@
 		/* Write the index value to the index_register (itself a region_field) */
 
 		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-				 &obj_desc->index_field.value,
+				 &obj_desc->index_field.value + field_datum_byte_offset,
 				 sizeof (obj_desc->index_field.value));
 		if (ACPI_FAILURE (status)) {
 			return_ACPI_STATUS (status);

Cheers,

Signature · 4 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#3 lore raw
In reply to a message not in the archive
Quoted 8 lines · Ducrot Bruno

Hi Andy,

There is a funny bug in acpi/executer/exfldio.c::acpi_ex_field_datum_io

When the field come from an indexed one, we read all the time from the address obj_desc->index_field.value
Unfortunately, this is wrong, since the correct address is obviously &obj_desc->index_field.value + field_datum_byte_offset

Ok, that one should be OK, now. My apologize for the first one.

drivers/acpi/executer/exfldio.c +7 -1
@@ -413,6 +413,8 @@
 
 
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
+		{
+		u32 old_addr = 0;
 
 
 		/* Ensure that the index_value is not beyond the capacity of the register */
@@ -424,9 +426,12 @@
 
 		/* Write the index value to the index_register (itself a region_field) */
 
+		old_addr = obj_desc->index_field.value;
+		obj_desc->index_field.value += field_datum_byte_offset;
 		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-				 &obj_desc->index_field.value,
+				 &obj_desc->index_field.value + field_datum_byte_offset,
 				 sizeof (obj_desc->index_field.value));
+		obj_desc->index_field.value = old_address;
 		if (ACPI_FAILURE (status)) {
 			return_ACPI_STATUS (status);
 		}
@@ -443,6 +448,7 @@
 			status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
 					  value, obj_desc->common_field.access_byte_width);
 		}
+		}
 		break;
 
 
Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
#5 lore raw
In reply to a message not in the archive
Quoted 12 lines · Ducrot Bruno
Quoted 8 lines · Ducrot Bruno

Hi Andy,

There is a funny bug in acpi/executer/exfldio.c::acpi_ex_field_datum_io

When the field come from an indexed one, we read all the time from the address obj_desc->index_field.value
Unfortunately, this is wrong, since the correct address is obviously &obj_desc->index_field.value + field_datum_byte_offset

Ok, that one should be OK, now. My apologize for the first one.

Definitely, I need to go to sleep.. Take the one from Robert Vollmert and that should be OK.

Quoted 13 lines
drivers/acpi/executer/exfldio.c +2 -0
@@ -413,6 +413,8 @@
 
 
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
+		{
+		u32 old_addr = 0;
 
 
 		/* Ensure that the index_value is not beyond the capacity of the register */

drivers/acpi/executer/exfldio.c line 432

Quoted 8 lines
drivers/acpi/executer/exfldio.c +3 -1
@@ -424,9 +426,12 @@
 
 		/* Write the index value to the index_register (itself a region_field) */
 
+		old_addr = obj_desc->index_field.value;
+		obj_desc->index_field.value += field_datum_byte_offset;
 		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-				 &obj_desc->index_field.value,
+				 &obj_desc->index_field.value + field_datum_byte_offset,
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
							      WEIRD!
Quoted 13 lines
drivers/acpi/executer/exfldio.c +2 -0
 				 sizeof (obj_desc->index_field.value));
+		obj_desc->index_field.value = old_address;
 		if (ACPI_FAILURE (status)) {
 			return_ACPI_STATUS (status);
 		}
@@ -443,6 +448,7 @@
 			status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
 					  value, obj_desc->common_field.access_byte_width);
 		}
+		}
 		break;
 
 
Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf