diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-03-08 04:21:02 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-11 19:45:04 -0400 |
commit | 3cf24497f45d61ed3c3290b5b03f3baeb8401f04 (patch) | |
tree | 32e5886ac23ccfd419694b33f83f518a9df45770 /drivers/acpi/acpica | |
parent | 98b5c9934ccdf6c04413e0d03c1ddeb32592d8c6 (diff) |
ACPICA: Fix a long-standing bug in local cache
Since 20060317, the pointer to next object is the first element in
its common header. Remove bogus LinkOffset from ACPI_MEMORY_LIST
and directly use NextObject.
Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/utcache.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index e0e8579deaac..2de22fbacf4b 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c | |||
@@ -85,7 +85,6 @@ acpi_os_create_cache(char *cache_name, | |||
85 | /* Populate the cache object and return it */ | 85 | /* Populate the cache object and return it */ |
86 | 86 | ||
87 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | 87 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); |
88 | cache->link_offset = 8; | ||
89 | cache->list_name = cache_name; | 88 | cache->list_name = cache_name; |
90 | cache->object_size = object_size; | 89 | cache->object_size = object_size; |
91 | cache->max_depth = max_depth; | 90 | cache->max_depth = max_depth; |
@@ -108,7 +107,7 @@ acpi_os_create_cache(char *cache_name, | |||
108 | 107 | ||
109 | acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | 108 | acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) |
110 | { | 109 | { |
111 | char *next; | 110 | void *next; |
112 | acpi_status status; | 111 | acpi_status status; |
113 | 112 | ||
114 | ACPI_FUNCTION_ENTRY(); | 113 | ACPI_FUNCTION_ENTRY(); |
@@ -128,10 +127,9 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | |||
128 | 127 | ||
129 | /* Delete and unlink one cached state object */ | 128 | /* Delete and unlink one cached state object */ |
130 | 129 | ||
131 | next = *(ACPI_CAST_INDIRECT_PTR(char, | 130 | next = |
132 | &(((char *)cache-> | 131 | ((struct acpi_object_common *)cache->list_head)-> |
133 | list_head)[cache-> | 132 | next_object; |
134 | link_offset]))); | ||
135 | ACPI_FREE(cache->list_head); | 133 | ACPI_FREE(cache->list_head); |
136 | 134 | ||
137 | cache->list_head = next; | 135 | cache->list_head = next; |
@@ -221,9 +219,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) | |||
221 | 219 | ||
222 | /* Put the object at the head of the cache list */ | 220 | /* Put the object at the head of the cache list */ |
223 | 221 | ||
224 | *(ACPI_CAST_INDIRECT_PTR(char, | 222 | ((struct acpi_object_common *)object)->next_object = |
225 | &(((char *)object)[cache-> | ||
226 | link_offset]))) = | ||
227 | cache->list_head; | 223 | cache->list_head; |
228 | cache->list_head = object; | 224 | cache->list_head = object; |
229 | cache->current_depth++; | 225 | cache->current_depth++; |
@@ -272,10 +268,8 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
272 | /* There is an object available, use it */ | 268 | /* There is an object available, use it */ |
273 | 269 | ||
274 | object = cache->list_head; | 270 | object = cache->list_head; |
275 | cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char, | 271 | cache->list_head = |
276 | &(((char *) | 272 | ((struct acpi_object_common *)object)->next_object; |
277 | object)[cache-> | ||
278 | link_offset]))); | ||
279 | 273 | ||
280 | cache->current_depth--; | 274 | cache->current_depth--; |
281 | 275 | ||