diff options
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r-- | drivers/acpi/utils.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index d0d84c43a9d4..68a809fa7b19 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -83,7 +83,7 @@ acpi_extract_package(union acpi_object *package, | |||
83 | return AE_BAD_DATA; | 83 | return AE_BAD_DATA; |
84 | } | 84 | } |
85 | 85 | ||
86 | format_string = (char *)format->pointer; | 86 | format_string = format->pointer; |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * Calculate size_required. | 89 | * Calculate size_required. |
@@ -262,11 +262,10 @@ acpi_evaluate_integer(acpi_handle handle, | |||
262 | if (!data) | 262 | if (!data) |
263 | return AE_BAD_PARAMETER; | 263 | return AE_BAD_PARAMETER; |
264 | 264 | ||
265 | element = kmalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); | 265 | element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); |
266 | if (!element) | 266 | if (!element) |
267 | return AE_NO_MEMORY; | 267 | return AE_NO_MEMORY; |
268 | 268 | ||
269 | memset(element, 0, sizeof(union acpi_object)); | ||
270 | buffer.length = sizeof(union acpi_object); | 269 | buffer.length = sizeof(union acpi_object); |
271 | buffer.pointer = element; | 270 | buffer.pointer = element; |
272 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | 271 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); |
@@ -321,12 +320,11 @@ acpi_evaluate_string(acpi_handle handle, | |||
321 | return AE_BAD_DATA; | 320 | return AE_BAD_DATA; |
322 | } | 321 | } |
323 | 322 | ||
324 | *data = kmalloc(element->string.length + 1, GFP_KERNEL); | 323 | *data = kzalloc(element->string.length + 1, GFP_KERNEL); |
325 | if (!data) { | 324 | if (!data) { |
326 | printk(KERN_ERR PREFIX "Memory allocation\n"); | 325 | printk(KERN_ERR PREFIX "Memory allocation\n"); |
327 | return -ENOMEM; | 326 | return -ENOMEM; |
328 | } | 327 | } |
329 | memset(*data, 0, element->string.length + 1); | ||
330 | 328 | ||
331 | memcpy(*data, element->string.pointer, element->string.length); | 329 | memcpy(*data, element->string.pointer, element->string.length); |
332 | 330 | ||
@@ -361,7 +359,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
361 | if (ACPI_FAILURE(status)) | 359 | if (ACPI_FAILURE(status)) |
362 | goto end; | 360 | goto end; |
363 | 361 | ||
364 | package = (union acpi_object *)buffer.pointer; | 362 | package = buffer.pointer; |
365 | 363 | ||
366 | if ((buffer.length == 0) || !package) { | 364 | if ((buffer.length == 0) || !package) { |
367 | printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", | 365 | printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", |